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
Great news!
http://interactive.freertos.org/entries/20857252-nios-updated-port-and-demo-for-nioseds-11-0-and-up-includes-lwip Everything is running fine? I suppose there's a latest LwIP release, no modifications, NO_SYS_NO_TIMERS=1? - Altera_Forum
Honored Contributor
FreeRTOS v7.1.0 and LwIP v1.4.0 without IPv6 support is used.
In LwIP I made this patch I created "patch# 7702: Include ability to increase the socket number with defined offset" this so I could more easily build a wrapper for read / write / fnctl / close. I asked if this could be implemented in the dev tree, and maybe it will be if there is enough interest. I modified Bill's driver a bit, so it releases a semaphore on which the tcp_input task is waiting. This way this task will be rescheduled asap after an RX SGDMA IRQ. Because of you asked about NO_SYS_NO_TIMERS I checked it out and I noticed that I created my own timer and timer task which seems useless when NO_SYS is set to 0 so I just uploaded the update which disables the timer and timer task because this will be managed by LwIP itself. The only problem remaining is that I must 'fragmentate' the output myself, the web sever I created can't send the main page ( +/-16KB ) of html/js source in one go. I guess this has to do with an faulty configuration somewhere... still searching for a solution. Hitting the LwIP mailing list in a sec :) - Altera_Forum
Honored Contributor
Hmm disabling the timer task was a bad idea, it makes the stack run quite unstable... enabled it again.
- Altera_Forum
Honored Contributor
Maybe it is worth using a hardware timer?
- Altera_Forum
Honored Contributor
I guess this would only make a little performance increase, because the only processing that safes is the alt_timer interface checking a timer each system tick right? Or am I overseeing something?
- Altera_Forum
Honored Contributor
Basically yes.
What about memcpy optimizations? Maybe worth adding a dma? - Altera_Forum
Honored Contributor
That might be a good idea :)
Currently trying to debug the large chunk issue but there is still a big problem though... let's first focus on that. :p - Altera_Forum
Honored Contributor
Great, I think this project could be maintained by more people than only You. Github maybe?
- Altera_Forum
Honored Contributor
Yeah, that was the idea :) I wanted to make the installer automatically download the latest version of LwIP and FreeRTOS but that wouldn't be possible on windows systems since they don't have curl and wget by default. Maybe I can implement this for the dev tree on github though... I'll be back Tuesday...
Further more, I think I found the possible cause of the bug, was just about to mail the mailing list for any advice. Hopefully I'm on to something ;) - Altera_Forum
Honored Contributor
One part of the bug solved, the input task first used the raw input method now input is inserted into the tcp stack via tcpip_input. Now I can send 14KB with one write... when I try to send more in one go the write function doesn't return, hope to fix it today!