AnsweredAssumed Answered

ENET Receive only once

Question asked by cuihan Ma on Sep 10, 2019
Latest reply on Sep 11, 2019 by Petr Stancik

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;
}

Outcomes