cancel
Showing results for 
Search instead for 
Did you mean: 

ENET DMA overflow on receive

jwester9
Associate II
Posted on October 17, 2007 at 06:38

ENET DMA overflow on receive

13 REPLIES 13
jwester9
Associate II
Posted on May 17, 2011 at 09:47

Hi

I use Keil ethernet driver with lwip and have problem to handle receive overflow on DMA.

I have enabled the RX_NEXT interrupt (generated if no valid descr found) and I also got the interrupt and trying to drop the packet by setting the VALID bit, but it not works, I got a new interrupt directly. Has anyone an example how to handle it in right way, maybe I have to go throu all descr and set the VALID bit ?

alandras
Associate II
Posted on May 17, 2011 at 09:47

What are you trying to achieve? Counting the dropped packets?

I don't now the KEIL driver, but the VALID bit should be set after you processed the packet. Until that packets are dropped automatically.

Andras

jwester9
Associate II
Posted on May 17, 2011 at 09:47

First of all I will get it running without stop and drop the overflow packets.

To clearify, if I set the NPOL_EN it will drop the packet automatically

and on RX_CURR_DONE I process the receive packet and set the VALID bit

If all descr are occupied the packets is dropped, but do I still got RX_CURR_DONE for the queued descr so I can continue to process recive packets

alandras
Associate II
Posted on May 17, 2011 at 09:47

you should have NPOL_EN=1 loaded from descriptor (ENET_RXNDAR) but also

NXT_EN=1 in ENET_RXCR loaded from DMA_CONTROL part of descripor (where DMA_XFERCOUNT = size is)

NPOL_EN is for polling only, if you can guarantee that next buffer is always valid, or you restart fetching after an overflow NEXT_EN should be enough. This could save some cycles depending on DFETCH_DLY but is more complicated than just setting the VALID bit.

Andras

[ This message was edited by: alandras on 27-09-2007 13:51 ]

jwester9
Associate II
Posted on May 17, 2011 at 09:47

It works now, and it was necessary with the loop.

The driver use 4 descr for receive and 2 descr for send, maybe the performance is little slow, maybe the stack is the problem

I have tested it with ping running and stop/run the board with debugger and the ping allways start again.

Also tested with Netwox generating random IP block together with ping, and ping mostley timeout but still running.

Thanks for all help

jwester9
Associate II
Posted on May 17, 2011 at 09:47

I have NPOL_EN as you describe and now it never stop, I also put in a loop in interrupt on RX_CURR_DONE to see if it is more than one descr ready, maybe this is not necessary ?

How can I counting dropped packets on easy way, shall I use RX_NEXT interrupt ?

alandras
Associate II
Posted on May 17, 2011 at 09:47

>>RX_CURR_DONE to see if it is more than one descr ready, maybe this is not necessary ?

I think so.

>>How can I counting dropped packets on easy way, shall I use RX_NEXT interrupt ?

There is a ''PACKET_LOST_EN: PACKET_LOST interrupt enable''

in the ''DMA Interrupt Enable Register'' and

''RX_TO_EN: RX_TO interrupt enable''

but is not well documented.

Andras

alandras
Associate II
Posted on May 17, 2011 at 09:47

Reference Manual

http://www.st.com/stonline/products/literature/um/12126.pdf page 98

Current Vector Address Register (VICx_VAR)

''– At the end of the ISR, write to the VIC0_VAR register (or VIC1_VAR if the interrupt source is from VIC1) to update the priority hardware.''

Could be this?

Andras

sarao
Associate II
Posted on May 17, 2011 at 09:47

JW,

Do you have sample code of your Ethernet (ENET) Interrupt Handler routine that you can post?

I think I'm having a similar problem:

1. Ethernet interrupts occur (RX_CURR_DONE)

2. Handle interrupt: copy data from descriptor, set valid bit

3. At some point later, I no longer get any interrupts

PROBLEM: I never see any of the error interrupts (PACKET_LOST_EN, RX_MERR_INT_EN, RX_TO_EN)

PROBLEM: I no longer get any receive interrupts either

Here is my current handler (trimmed down):

Code:

void ENET_IRQHandler(void)

{

while ( (ENET_DMA->ISR) & ENET_DMA->IER )

{

// 15: RX_CURR_DONE_EN: RX_CURR_DONE interrupt enable

if ( ENET_DMA->ISR & 0x00008000 )

{

ENET_IRQ_COUNT[15]++;

if ( ENET_HandleRxPkt( RCVR_BUFFER ) == 0 )

{

while ( 1 )

{

}

}

ENET_DMA->ISR |= 0x00008000;

}

}

}