Transmission Problem in MPC 5777M FEC

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

Transmission Problem in MPC 5777M FEC

1,256 Views
yalamandadosaky
Contributor V

Hi All, I am developing the Ethernet driver  for MPC 5777M, My driver (FEC) is not clearing the Ready bit ,when I call Eth_tx function shown below.

void Eth_Tx(u16_t len)
{
    au32TxBDs[0U] = 0x8C000000U | len;
    Reg32Write(FEC_TDAR, 0x01000000U);
    while(0x80000000U == (au32TxBDs[0U] & 0x80000000U));

    au32TxBDs[0] = 0x00000000U;  // Clear the Ready bit, the rest will be set later
    au32TxBDs[1] = (u32_t)au8TxBuff;  //Data pointer
    au32TxBDs[0] = 0x20000000U; // Set the Empty bit and the Wrap bit
}

And my buffer descriptors are

/* Buffer sizes and counts */
#define RX_BUFF_SIZE (1536u)
#define TX_BUF_SIZE (1536u)

/* Buffer descriptors: */
__attribute__(( aligned(16) ))
volatile u32_t au32RxBDs[2U]= {0u};
__attribute__(( aligned(16) ))
volatile u32_t au32TxBDs[2U] = {0u};

/* Buffers: */
__attribute__(( aligned(64) ))
u8_t au8RxBuffs[RX_BUFF_SIZE] = {0u};
__attribute__(( aligned(64) ))
u8_t au8TxBuff[TX_BUF_SIZE] = {0u};

Can anyone help me how to sort out this problem ?

2 Replies

911 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

It seems you do not have Tx BD properly configured. I understand you have 1 Tx and 1 Rx BD defined.

However you should have at least 2 Tx BDs to ensure that there is always at least one TxBD with the R bit cleared in the Tx BD ring.

The last (here second) TxBD in a ring must have Wrap bit set. Once you will prepare BD for transmission you will swap between Tx BDs.

 

One example is posted for example here https://community.nxp.com/message/882044

BR, Petr

911 Views
yalamandadosaky
Contributor V

Hi PetrS  , Thank you for the reply. I have Disabled  the cache(Removed D_CACHE Flag from settings in the IDE) with single TxDesc and RxDesc , it is resending(Two times) the frames for a  udp/tcp/arp request messages. Currently I am modifying my code to two descriptors for both Txdesc and Rxdesc.

I have doubt in your example code that  why we need two rxbuffers and only one txbuf as you already using two descriptors both tx and rx.

uint8_t txBuf[1536] __attribute__ ((aligned (16)));
uint8_t rxBuf[2][1536] __attribute__ ((aligned (16)));

Can you please help me how to disable cache region only for those buffers instead of removing for whole ??

0 Kudos
Reply