ENET Rx Buffer Descriptors are not setup properly in SDK 2.11.0

cancel
Showing results for 
Search instead for 
Did you mean: 

ENET Rx Buffer Descriptors are not setup properly in SDK 2.11.0

492 Views
lh_dan
Contributor I

Porting a K65 project to SDK 2.11.0, I was having issues with receiving packets over ethernet and discovered that the Rx Buffer Descriptors are not setup properly. In fsl_enet.c ENET_SetRxBufferDescriptors(), the control register is never initialized when using the new zero-copy buffer allocation method in enet_ethernetif_kinetis.c.

                if (config->rxBuffAlloc == NULL)
                {
                    curBuffDescrip->buffer = (uint8_t *)((uint32_t)&rxBuffer[count * rxBuffSizeAlign]);
                    /* Initializes the buffer descriptors with empty bit. */
                    curBuffDescrip->control = ENET_BUFFDESCRIPTOR_RX_EMPTY_MASK;
                }

Because rxBuffAlloc is defined, moving the initialization outside of this conditional solves the issue.

               if (config->rxBuffAlloc == NULL)
                {
                    curBuffDescrip->buffer = (uint8_t *)((uint32_t)&rxBuffer[count * rxBuffSizeAlign]);
                }

                /* Initializes the buffer descriptors with empty bit. */
                curBuffDescrip->control = ENET_BUFFDESCRIPTOR_RX_EMPTY_MASK;
0 Kudos
4 Replies

478 Views
nxf77486
NXP Employee
NXP Employee

Hello @lh_dan ,

 

Thank you in advance for your information but can you please help me with some extra information?

  1. This is an SDK example, and the example is not working properly? Please let me know what example of the SDK you are testing.
0 Kudos

467 Views
lh_dan
Contributor I

nxf77486

I did not try this with a SDK example but with the port of one of my projects. I would assume that any example could have a similar issue as the BD control is never initialized. However, if the memory used by the BD is lucky enough to be zero'ed at startup I would guess that everything would seem to work.

0 Kudos

445 Views
nxf77486
NXP Employee
NXP Employee

Hello @lh_dan ,

 

I will recommend to test and example of the SDK just to make sure that this problem is or not included inside the SDK example and to find a solution to this problem. Please also let me know if you have any other question I will be happy to assist you.

0 Kudos

427 Views
lh_dan
Contributor I

Since all of the examples use fsl_enet.c, I am fairly certain that they have the same issue. The control register is not initialized when config->rxBuffAlloc is not NULL. This is obvious. As far as reproducing though it is hardware dependent. If the RAM used by the buffer descriptor defaults to zero it would seem to work. Please look at the code and verify what I have stated.

 

0 Kudos