Hi all,
I'm stuck with an Ethernet driver problem. I'm getting buffer overrun errors on some packets which subsequently are dropped. I'm using lwIP1.3.0 TCP/IP stack, but my problem is on the low level (drivers).
I have included my driver code (which has been taken mostly from the FreeRTOS port), but again, please concentrate on the FEC buffer ring code, frame reception code, and its ISR routine.
files:
fec.c // the receive task, Rx ISR, init code, etc.
fec.h
nbuc.c // the fec buffer ring module
nbuf.h
Thanks
regards
FB
0xFB wrote:
I'm stuck with an Ethernet driver problem. I'm getting buffer overrun errors on some packets which subsequently are dropped.
The 5282 chip has uncorrected flaws when used on 10BaseT links. The Device Errata sheet from Freescale (Document Number: MCF5282DE) includes paragraphs titled "FEC Receive Buffer Overrun in 10BaseT Mode" and "Concantenation of Received Frames in 10BaseT Mode".
One of the workarounds suggests that buffers need to be 64 bytes longer than the longest frame, but we have found they need to be a full 2048 bytes to prevent memory corruption. I have not seen published drivers that cope with the 5282 errata.
Bkatt,
full 2048 bytes buffer length checked:
MCF_FEC_EMRBR = 2048 - 1;
I must check to be shure FEC operates on 100baseT
My drivers seems pretty much like the one Paolo talks about.
Beside the dropped frames, I got now a Rx buffer that says EMPTY and IN_USE at the same time. Then the program gets stuck in infinite loop in the FEC receive routine.
Please let us know what was the issue as soon as you get it
Feel free to take whatever you want from the code and modify it as you like
Its seems that reducing the Rx buffer length from 2048 to 1520 made my program a lot more stable. I guess that my problem was memory corruption as the firmware was bugging or jamming at strange places.
Maybe the stack was getting corrupted by the ring of buffers, like a case I saw on a similar post on the forum.
THanks for your help
Francois
Try to look at An3928SW.zip file. It contains lwIP 1.3.0 with FreeRTOS 5.3.0 using the same FEC controller (fec.c and nbuf.c). Then you will be able to look at the differences and fix them. Now I'm running this SW with 5235 and without any memory restriction as MCF51CN12 :smileyhappy:
Good luck
Hi Paolo,
Thanks for the reply, Could you please point me out where to find "An3928SW.zip"?
Francois
I got the file