Skip to main content
Visitor II
August 9, 2022
Solved

STM32H7: New HAL and PBUF_POOL usage

  • August 9, 2022
  • 1 reply
  • 1185 views

Hi all,

I am developing an application using bare TCP and UDP connections.

Since the new HAL implementation now uses custom PBuf allocation for Rx memories, I thought about killing the PBUF_POOL since it does not seem to be used anymore now.

I started by testing my application with statistics enabled and indeed, the usage count of memp_stats_PBUF_POOL stayed at zero all the time.

Setting PBUF_POOL_SIZE to 0 reduced my RAM usage as expected and the application is still running normally.

Am I missing anything here? Are you guys aware of some pitfall I did not see or do you think I am safe so far?

    This topic has been closed for replies.
    Best answer by MWB_CHa

    Probably too late to answer, sorry, but it might help others with same issue:

    We can confirm that new HAL Ethernet implementation now uses custom PBuf allocation for Rx and PBUF_POOL is not used anymore in interface and apps.

    But PBUF_POOL is used inside LwIP stack. In fact in LwIP\src\core\udp.c line 391 PBUF_POOL is used: 

    “q = pbuf_clone(PBUF_RAW, PBUF_POOL, p);�?

    In your case, maybe PBUF_POOL is not used by LwIP stack but it can happen in other cases.

    So before killing the PBUF_POOL, you have to verify that LwIP stack is not using PBUF_POOL first.

    I hope it helps.

    1 reply

    MWB_CHaAnswer
    ST Employee
    February 10, 2023

    Probably too late to answer, sorry, but it might help others with same issue:

    We can confirm that new HAL Ethernet implementation now uses custom PBuf allocation for Rx and PBUF_POOL is not used anymore in interface and apps.

    But PBUF_POOL is used inside LwIP stack. In fact in LwIP\src\core\udp.c line 391 PBUF_POOL is used: 

    “q = pbuf_clone(PBUF_RAW, PBUF_POOL, p);�?

    In your case, maybe PBUF_POOL is not used by LwIP stack but it can happen in other cases.

    So before killing the PBUF_POOL, you have to verify that LwIP stack is not using PBUF_POOL first.

    I hope it helps.