Showing results for 
Search instead for 
Did you mean: 

Problem sending udp frame with MXCHIP on B-U585I-IOT02A. Chained buffer management/restructuring problem.


I have a problem in sending udp multicast frame via wifi (with the MXCHIP embedded on the card). The problem occurs when there are chained buffers in play. These buffers come from the lwip lib when Pbuf is allocated with the PBUF_REF option in the pbuf_alloc() function.

Note : I work with the project base b_u585i_iot02a_ntz from the extension : X-CUBE-AWS (STM32CubeExpansion_Cloud_AWS_V3.0.0).

The pointer given as parameter to xQueueSend for the wifi sending via the MXCHIP module in the mx_lwip.c file (line 170) is "pxPbufToSend". But, at line 159 of this same file, we add to "pxPbuf" a "MXHeader" with (vAddMXHeaderToEthernetFrame), which seems useful for the sending of the frame. When this buffer (pxPbuf) is not chained, pxPbuf and pxPbufToSend are linked with the same address (line 126) so the addition of this Header on pxPbuf is propagated on pxPbufToSend. And the sending is done correctly. However, a problem occurs when pxPbuf is chained (pxPbuf->next != NULL). So, at line 136 of mx_lwip.c, the pxPbufToSend is restructured into an unchained buffer (merging of buffers chained) BUT the address of pxPbufToSend is modified, and is now different from that of pxPbuf. So, the addition of "MXHeader" does not propagate to the pxPbufToSend buffer anymore and the sending is not done.