Holger Sachs

LPC546xx SDK2.2 Ethernet: code mistake

Discussion created by Holger Sachs on Aug 30, 2017
Latest reply on Aug 31, 2017 by jeremyzhou

There is a mistake in the function ENET_DescriptorInit of SDK2.2:

 

The original order is:

  1. Determine, whether the RX interrupt is enabled:
    intRxEnable = (base->DMA_CH[channel].DMA_CHX_INT_EN & ENET_DMA_CH_DMA_CHX_INT_EN_RIE_MASK) ? true : false;
  2. Initialize TX descriptors:
    if (ENET_TxDescriptorsInit(base, bufferConfig, intTxEnable, channel) != kStatus_Success) ...
  3. Determine, whether the TX interrupt is enabled:
    intTxEnable = (base->DMA_CH[channel].DMA_CHX_INT_EN & ENET_DMA_CH_DMA_CHX_INT_EN_TIE_MASK) ? true : false;
  4. Initialize RX descriptors:
    if (ENET_RxDescriptorsInit(base, bufferConfig, intRxEnable, channel, doubleBuffEnable) != kStatus_Success) ...

 

The problem is: in step 2 the variable intTxEnable is used uninitialized.

One possible order of the steps would be: 3-2-1-4

 

Best regards,

Holger Sachs

Outcomes