lwip stack ping test replies the request with mismatched sequence number message

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

lwip stack ping test replies the request with mismatched sequence number message

391 Views
zjldabing
Contributor II

I developed a board with S32K344 and it can run the lwip demo project "lwip_s32k344" correctlly.I can ping the board from my PC.However, it works abnormally when I try to implement the demo code into my own project on the board.When I ping it from PC, the reply message sequence number is always smaller than the request message sequence number. That means the board does not reply the 1st request and it replies the following request with the one for previous request.


I have compared the setting of demo project with that of my own project.There is no obvious difference from my point of view. What's the problem here and how can it be solved? Attach my project.

ping.png

0 Kudos
2 Replies

375 Views
zjldabing
Contributor II

I find the problem is caused by different compiling settings between demo project and my project.My project has defined D_CACHE_ENABLE.Seems the D.CACHE is a specific feather of M7 core(CM3 and CM4 does not have it).I remove the definition of D_CACHE_ENABLE and project works well.

 

0 Kudos

363 Views
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @zjldabing 

yes, it's caused by data cache. Let me copy here from some other discussion:

 

The default project setting enabled Cache, and the lwip heap memory was allocated from cacheable region. Thus there are risks about data inconsistency when CPU and EMAC uDMA access asynchronously. Two way to avoid this issue:

① Just disable the D-cache, the original Lwip_s32k344 demo use the same way. It's convenient, but lower running efficiency for other applications.

② Allocate the lwip heap from non-cacheable region. Thus the cache can keep enable, it's good. When use this way, you need to make below changes:

  a) Increase the non-cacheable region (decrease shareable region)  in linker file and add the lwip non-cacheable heap region for next use.

lukaszadrapa_0-1696939942650.png

 

lukaszadrapa_1-1696939942210.png

 

  b) Add lwip memory allocation macro in .mex tcpip component "user setting" page, thus it would be generated in lwipcfg.h, and to replace the default allocation way in "arch.h" which allocate memory from shareable region.

lukaszadrapa_2-1696939942316.png

 

Regards,

Lukas

 

0 Kudos