Forum Discussion
Altera TSE driver and example program for lwIP (1.3.2)
After many many requests and complaints about lack of support and/or documentation for support of lwIP for the Altera TSE, I have developed a drop-in TSE driver and example program and made this available to the NIOS II community. This was done for NIOS II 8.1 SP0.01. I don't expect difficulty with version 9.x.
This is for the latest version of lwIP (the latest is as of this post) for a minimal program and HTTP server based on the http server in the lwIP contrib folder. The lwIP TSE driver uses the altera_avalon_tse driver and SGDMA as-is. There is a complete (as in 41-step) set of instructions on creating the project and example program. More information and the link to the driver is available here: http://lwip.wikia.com/wiki/available_device_drivers#lwip_1.3.2 Please direct any questions, changes for NIOS II 9.1, or comments to this thread. 12-16-2010 update: This example works with NIOS Version 10.0 with some tweaks to the procedure to create the project. Also, a lwIP 1.4 release candidate has been out for a while and it drops into this example (in place of 1.3) without changes. Bill257 Replies
- Altera_Forum
Honored Contributor
hi,i'm a new user.I had download the software and it can run in the nios 9.1.It is really nice.Can i ask you some question?
1)if i wan to use udp format to send image.Can i use this code? 2)there is a udp c++ source file in the test folder.I wonder that udp file can be used as the apart of my study for sending udp packet? 3)Do you have any design example regarding use of udp format to send image? Thank you siang - Altera_Forum
Honored Contributor
I'll answer this one if nobody minds...
1) Yes you can, you can stream a JPEG (if you use RTP over UDP) or you can just send it and let some application assemble it back (don't know what do you need it for). Anyway, for RTP check out: RFC2435, RFC3550 and RFC3551. Also, download lwip documentation. 2) udp.c contains functions for UDP processing. Have a look at the httpd server example included in this Nios II port to get a better picture on how to use the lwip for UDP processing (the HTTPD is built on TCP, but more-less, it's the same principle with UDP, only easier). 3) Just read all of the above and you should have a good picture on how to use lwip for your particular task. Best regards... Ivan - Altera_Forum
Honored Contributor
Hi,my goal is to send a image from board to pc via udp packet.I face a problem:when i using the wireshark to inspect the ethernet traffic.It can show all the packet is sent.But i have using a high level software to open the picture.i have change the destip,sourceip and port is same as the nios.But there is nothing shown.Can any 1 help me?thank you.
- Altera_Forum
Honored Contributor
Dear BillA
Let me give the description of my probelms. I download the LwIP 1.4 and lwip_altera_tse_driver,and set up the Nios2 and TSE sopc project according to some standard TSE Project.The PHY may be is OK,becaucle the net speed in my host displayed is 100Mbps, But I can't send or receive UDP packet, can't set the speed from 100Mbps to 1000Mbps, there are nothing in the interface when I send or receive any packet.I can't down load the example. Can you post the LwIP example again, or send the TSE SoPC project to me,my emails is cngaoxf @yahoo.com.cn. Thank you Let me give my best wishes to you. - Altera_Forum
Honored Contributor
Dear ims
can you post all the software of udp offload, not just udp_test.c which I can't compile successfully. best Wishes to you - Altera_Forum
Honored Contributor
Dear xf.gao; I’ve sent to your email the code completing udp_test.c from my post (#35). This is basically just an original Bill’s example upgraded with lwIP-1.4.0rc1. You should be able to run the example if (and only if) you are able to run standard Altera’s SimpleSocketServer on your board also. There are no any special requirements to SOPC or BSP. Regards, Igor.
- Altera_Forum
Honored Contributor
Dear BillA or ims
Let me give the description of my probelms in details. I download the LwIP 1.4 and lwip_altera_tse_driver and udp_test,and set up the Nios2 and TSE sopc project according to some standard TSE Project.The PHY may be is OK,becaucle the net speed in my host displayed is 100Mbps, But I can't send or receive UDP packet, can't set the speed from 100Mbps to 1000Mbps, there are nothing in the interface when I send or receive any packet.I can't down load the example. Can you post the LwIPexample again, or send the TSE SoPC project to me,my emails is cngaoxf @yahoo.com.cn. Thank you Let me give my best wishes to you. - Altera_Forum
Honored Contributor
xf.gao,
I think you need to go deeper than the software. Check the wiring to and from the PHY. There is nothing special about the lwIP example. As IMS and I have said a few times here, load the Altera Simple Socket Server demo and debug that because you know without question that should work. If that won't work, it probably is hardware or something in SOPC. But our SOPC won't help you because it's probably the pin connections are bad. The way we connected SGDMA, Descriptor Memory and the busses to the NIOS II CPU are standard. We also followed a basic TSE SOPC example to get going. Be sure your clocks, bridges and desc memory are done exactly as in the example. Hmmm, maybe this is even as simple the hardware is bad or has a bad component. To answer you directly, I cannot provide the SOPC file since it has our entire product design included. I'll add that we did nothing special with the TSE, SGDMA, Desc Mem and bridges as the reference design we used. Bill - Altera_Forum
Honored Contributor
Hello,
sorry for taking up old thread, but did anyone try data receive using LwIP? Whats the maximum throughput? Is it possible to achieve at least 80Mbit/s using 100Mbps link? I suppose data reception should be easier, if I don't need to recalculate checksums and move data to DMA. - Altera_Forum
Honored Contributor
Throughput is dependent on many things - both NIOS II system related things and lwIP build/options related things. There are many things you can do to improve performance - somewhere in this thread IIRC I listed them in what I perceive as the order of importance.
All of our lwIP based NIOS II products have high performance requirements. One was Gigabit and required high transmit bandwidth and TCP couldn't be used so we used our own reliable UDP protocol. We had no problems with 500Mb. The latest product is GigaBit too but performance for receiving is important. We have better performance to run 10/100 over 1000! We have 40Mb throughput and this is far more than we need so no special protocol was used. But in all of these systems internet checksumming is done in the FPGA (Cyclone III). This 40Mb is an effective average rate for us - let me do a test for sustained receive bandwidth and I'll post back here. So to correct you, receiving is harder (slower) than sending - by quite a bit. And remember, the more you do to improve TCP/IP speeds the less time the NIOS II has for other tasks. You can probably do 80Mb receive but you'd have no time to do anything with the data. :) High speeds can be achieved but you may have to do a lot to get there. Bill