Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
17 years ago

Ethernet with NiosII on Cyclone III FPGA Board?

I would like to use the ethernet on the cyclone 3c120 fpga development board with NiosII and the Niche TCP/IP stack. Anybody has done this already or knows about a quick solution? The CD of this development kit containts only a basic nios2 reference design..

Thanks for help,

Christian

24 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    i have been researching how to hookup the TSE core to a NIOS processor for a while now. through your link to the 9.0.2 version ( i had the 7.2 version) i finally found the solution! all along, i just needed to use a Scatter-Gather DMA Controller to connect the streaming sources to the NIOS.

    unfortunately, now i have to figure out how to send and recieve UDP messages... haha. Thanks for the Information Daixiwen.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello Dai -

    I did get the linux build/hjardware you sent me a link to (the one without the LCD nios) up and running the SSS example - now I am trying to get UDP running on it. I replaced SSSSimpleSocketServer() with the following... The results is that I get nothing when sending a udp packet to the board. The code is stalled in the recvfrom and it is waiting... I am using UDP tester to send to port 1024 and verifying that it is on the wire with packetmon...

    Any help would be most appreciated...

    Thanks - Chris

    void ssssimplesocketservertask()

    {

    struct sockaddr_in serverAddr;

    int udpsock, status=0, bytes_sent=0;

    alt_u8 buf[MAX_UDP_LENGTH], id_packet=0;

    int fromlen;

    //----------- Socket Configuration --------------

    serverAddr.sin_family = AF_INET;

    serverAddr.sin_port = htons(UDP_PORT);

    serverAddr.sin_addr.s_addr = INADDR_ANY;

    fromlen = sizeof (serverAddr);

    if ((udpsock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { // protocol <IPPROTO_UDP>

    alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"[sss_task] Socket creation failed");

    }

    //----------- system init goes here --------------

    //----------------------------------------------

    //------------- Main loop for task ---------------

    //----------------------------------------------

    while(1){

    printf("listening to UDP port...\n");

    printf("serverAddr.sin_family = %08x\n", serverAddr.sin_family);

    printf("serverAddr.sin_port =%08x\n", serverAddr.sin_port);

    printf("serverAddr.sin_addr.s_addr =%08x\n", serverAddr.sin_addr.s_addr);

    printf("serverAddr =%08x\n", serverAddr);

    if((recvfrom(udpsock, buf, 10, 0,(struct sockaddr*)&serverAddr, &fromlen)) <0 )

    {

    alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"[sss_task] rx UDP error");

    }

    else

    {

    printf("we got here\n");

    }

    &#12288;

    printf("datagram : %s", buf);

    }

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    OK - that was dumb - I wasn't binding the socket - so now I have UDP traffic. The next question I have I'll start a new thread for as it's relating to the TSE with the dual SGDMA modules...