ENET Receive only once

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

ENET Receive only once

803 Views
Ada_Lovelace
Contributor IV

HI all.

I have a problem about ENET receive , I change the receive mode interrupt to polling, take the ENET_RX_HANDLE code ,put it in the while(1),but I can only receive the data only once, I can not understand , do I miss something?

int main(void)

{
uint16_t net0_id=0,net1_id=0;
uint8_t *buff;
uint32_t counter = 0;
int c;
char start_message[]="system is running---";
uint8_t status;

xcptn_xmpl (); /* Configure and Enable Interrupts */

peri_clock_gating(); 
system160mhz();
hw_init();

// Initialise the ENET module
ENET_UDP_Driver_Init();

//Enable the Receiver Interrupt
ENET_Driver_Rx_Init();

while(1)
{

if(ENET.RDAR.B.RDAR == 0)
{
rxBD = getActiveRxBD();

// If the data buffer has not been filled do nothing
if (rxBD->status0 & RX_BD_S0_E == RX_BD_S0_E) return;
if(rxBD->length != 0)
{
// Extract the frame
rxFrame = (EthernetFrame *) rxBD->data;
if(rxFrame->length == ARP)
{
ENET_frame_Tx(ARP_packet, 42, ARP, ARP_packet, 0);
}
}
// Mark the receive buffer empty
markRxBDEmpty(rxBD);

// Flag that descriptors are available to allow reception
ENET.RDAR.R = 0x0100000;

ENET.EIR.R = 0x02000000;

}
#endif
}

return 0;
}

Labels (1)
0 Kudos
1 Reply

723 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

did the receiving work normally with interrupt mode? Or it also receive data only once? If not check if data cache is disabled or at least buffer descriptors are in non cacheable area.

If it was working, then it should work in polled mode too.

For your code; I think you should not use RDAR for polling if there are more descriptors in the ring. Use just EIR[RXF] flag for checking. 

Line "if (rxBD->status0 & RX_BD_S0_E == RX_BD_S0_E) return;" is nonsense as it exits main() function.

BR, Petr

0 Kudos