ENET_UDP_Tx problem in on S32R274

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

ENET_UDP_Tx problem in on S32R274

1,161 Views
yi-linhsieh
Contributor III

Hello,

I try to send UDP packet using ENET_UDP_Tx() in ENET_RADAR.c.

It is okay send one by one packet in Debug.

But I write a for loop to send 1024 byte UDP packets with serial number. 

But packet loss. 

So I add  "while(ENET.TDAR.B.TDAR) ;" in  ENET_UDP_Tx to make  sure transmit done.

 

void ENET_UDP_Tx(uint8_t *buffer, uint32_t size)
{
while(ENET.TDAR.B.TDAR) ; //yilin test wait TDAR

// Modify the UDP header to populate the IPv4 length field
UDP_header[16] = ((IPv4_HEADER_LEN + UDP_HEADER_LEN + size) >> 8) & 0xFF;
UDP_header[17] = (IPv4_HEADER_LEN + UDP_HEADER_LEN + size) & 0xFF;
// Modify the UDP header to populate the UDP length field
UDP_header[38] = ((UDP_HEADER_LEN + size) >> 8) & 0xFF;
UDP_header[39] = (UDP_HEADER_LEN + size) & 0xFF;
// Clear the checksums
UDP_header[24] = 0x00;
UDP_header[25] = 0x00;
UDP_header[40] = 0x00;
UDP_header[41] = 0x00;
txbd[0].status0 |= TX_BD_S0_R;

txbd[1].data = buffer;
txbd[1].length = (uint16_t)size;

/* Mark all buffer descriptors as ready */
txbd[1].status0 |= TX_BD_S0_R;


ENET.TDAR.B.TDAR = 1; // Start transmission

}

 

 

I had tried to check "txbd[0].status0 & TX_BD_S0_R == 0", but not work.

Is there any way to make this more efficiency?

 

Updated: I'm testing on S32R EVB and  ENET_RADAR.c is part of S32R274_MR3003_GHS sample

 

Kuan Hung Lin

Labels (1)
3 Replies

582 Views
yi-linhsieh
Contributor III

Hi,

I'm testing on S32R EVB.

Using ENET_RADAR.c which is part of S32R274_MR3003_GHS sample.

In S32R274_RM

Enhanced transmit buffer descriptor field definitions

txbd[0].status0 Description

The data buffer associated with this BD is not ready for transmission. You
are free to manipulate this BD or its associated data buffer. The MAC
clears this field after the buffer has been transmitted or after an error
condition is encountered.

When MAC 0 Transmit Buffer Done inturrupt

I checked  txbd[0].status0 but it didn't be clear.

Cloud it be a cache problem?

0 Kudos

582 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

ENET uses internal DMA transfers, so the memory which is used for storing frames should not be cached.

Could you please attach here your project? I do not know what is S32R274_MR3003_GHS sample. If you post here your project I will be able to help you more precisely.

Regards,

Martin

582 Views
martin_kovar
NXP Employee
NXP Employee

Hi,

do you use NXP EVB or you have your own design board?

Could you please share the whole project? I need to check it on my side.

Regards,

Martin

0 Kudos