FEC buffer overrun. MCF5282 CW7.1.1a please help

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FEC buffer overrun. MCF5282 CW7.1.1a please help

2,767 Views
francois_boucha
Contributor III

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

Labels (1)
0 Kudos
Reply
8 Replies

980 Views
bkatt
Contributor IV

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.

 

0 Kudos
Reply

980 Views
francois_boucha
Contributor III

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.

0 Kudos
Reply

980 Views
PaoloRenzo
Contributor V

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

0 Kudos
Reply

980 Views
francois_boucha
Contributor III

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

0 Kudos
Reply

980 Views
francois_boucha
Contributor III

oups I forgot attachment!

 

ethernet_drivers.zip

Message Edited by t.dowe on 2009-10-07 09:01 AM
0 Kudos
Reply

980 Views
PaoloRenzo
Contributor V

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

0 Kudos
Reply

980 Views
francois_boucha
Contributor III

Hi Paolo,

 

Thanks for the reply, Could you please point me out where to find "An3928SW.zip"?

 

Francois

0 Kudos
Reply

980 Views
francois_boucha
Contributor III

 I got the file :smileyhappy:

0 Kudos
Reply