Skip to main content
Associate
July 20, 2024
Solved

data cache issue for ethernet in stm32h753 (Assertion "pbuf_free: p->ref > 0" failed at line 753)

I have read quite a few threads about ethernet on the H7, along with several internet posts. 

I've followed this guide:

https://community.st.com/s/article/How-to-create-project-for-STM32H7-with-Ethernet-and-LwIP-stack-working?t=1679361727348

As well as this guide:

https://github.com/AnielShri/STM32H745_Ethernet/blob/master/Documentation/lwip_nortos.md

They are similar, with some slight differences with the MPU cache settings.

My first test is just basic ICMP - which doesn't work. That is, until I comment out this line:

SCB_EnableDCache();

So, of course, that implies something with the data cache, and memory locations.

So, my settings looks like these:

Rahul3_0-1721488939196.png

 

LWIP settings:

Rahul3_1-1721488938984.png

 

 

I've added the following to the linker script:

 /* Modification start */
 .lwip_sec (NOLOAD) : {
 . = ABSOLUTE(0x30040000);
 *(.RxDecripSection) 
 
 . = ABSOLUTE(0x30040060);
 *(.TxDecripSection)
 
 . = ABSOLUTE(0x30040200);
 *(.RxArraySection) 
 } >RAM_D2

Sometimes, I get this error upon each ICMP packet that is received:

 Assertion "pbuf_free: p->ref > 0" failed at line 753 in ../Middlewares/Third_Party/LwIP/src/core/pbuf.c

Again, it goes away when I disable the dcache. I'm not sure what else to try. I must have something not quite right.

Thanks.

This topic has been closed for replies.
mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
September 7, 2024

Hello,

Probably an issue in the LWIP heap memory region:

I suggest you to check again the MPU config (Bufferability, Sharability, Cachability and TEX level) as described in https://community.st.com/s/article/How-to-create-project-for-STM32H7-with-Ethernet-and-LwIP-stack-working?t=1679361727348:

95.png

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.

1 reply

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
September 7, 2024

Hello,

Probably an issue in the LWIP heap memory region:

I suggest you to check again the MPU config (Bufferability, Sharability, Cachability and TEX level) as described in https://community.st.com/s/article/How-to-create-project-for-STM32H7-with-Ethernet-and-LwIP-stack-working?t=1679361727348:

95.png

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.