help! MK64 :why ENET_MacSendData stuck in while(ENET->EIR & ENET_EIMR_TXF_MASK); ?

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

help! MK64 :why ENET_MacSendData stuck in while(ENET->EIR & ENET_EIMR_TXF_MASK); ?

391 Views
2321
Contributor I
Dear Expert
The MCU I am using is MK64FX512XXX12, 
when we use this function ,send eth data for a while, it will stucked in " while(ENET->EIR & ENET_EIMR_TXF_MASK);  ".
 
 
无效ENET_MacSendData(uint8_t*数据,uint16_t镜头)
{
    ENET->EIR = ENET_EIMR_TXF_MASK;
    /* check if buffer is readly */
    //while( pxENETTxDescriptor->status & TX_BD_R ) {};
        
    /* set Tx Descriptor */
pxENETTxDescriptor->data = (uint8_t *)__REV((uint32_t)data);
    pxENETTxDescriptor->length = __REVSH(len);
    pxENETTxDescriptor->bdu = 0x00000000;
pxENETTxDescriptor->ebd_status = TX_BD_INT | TX_BD_TS;// | TX_BD_IINS | TX_BD_PINS;
pxENETTxDescriptor->status = ( TX_BD_R | TX_BD_L | TX_BD_TC | TX_BD_W );
        
    /* enable transmit */
    ENET->TDAR = ENET_TDAR_TDAR_MASK;
    while(ENET->EIR & ENET_EIMR_TXF_MASK);         //   why stuck in this "while" ?
}
 
we have no idea  why?  isn't  this bit  set or reset by hardware?
This problem has been bothering me for a long time, please help me to solve this problem.
Thanks.
--weilu.
 
Tags (1)
0 Kudos
1 Reply

344 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As the following Fig, the Bit 27 TXF is updated by hardware, the bit is explained as:

"

Transmit Frame Interrupt
Indicates a frame has been transmitted and the last corresponding buffer descriptor has been updated

"

xiangjun_rong_0-1695801985400.png

I suppose that the ethernet frame is not transferred, so the bit is not set.

Pls check you code

BR

XiangJun Rong

 

0 Kudos