cancel
Showing results for 
Search instead for 
Did you mean: 

MQTT_VAR_HEADER_BUFFER_LEN

ramazan_kavak
Associate

I am trying to send and subscribe data via mqtt protocol using the lwip library with an STM32F207 series microcontroller. When I define MQTT_VAR_HEADER_BUFFER_LEN as 256, I have no problem receiving data. However, when I set MQTT_VAR_HEADER_BUFFER_LEN to 512 to get larger data, the incoming buffer content is empty. How can I solve this? I need to make the Buffer_Len size at least 512.

1 REPLY 1
STea
ST Employee

Hello @ramazan_kavak ,

I'm lucking a lot of context to help me understand the origin of your issue but here are some general recommendations.

Ensure that the memory allocation for the lwIP stack is sufficient by adjusting the heap and stack sizes in your FreeRTOS or system configuration (if using any). Specifically, increase the memory pool sizes in the lwipopts.h file, and adjusting PBUF_POOL_SIZE andPBUF_POOL_BUFSIZE to accommodate the larger buffer size. Additionally, ensure that other MQTT-related configurations are consistent with the increased buffer size. Debugging statements can help identify if the issue is due to memory constraints or buffer mismanagement. For example, you might configure your lwipopts.h file with MEM_SIZE set to 16000, PBUF_POOL_SIZE to 16, and PBUF_POOL_BUFSIZE to 512. Also, monitor system resources to ensure the system is not running out of resources. By carefully adjusting these configurations and monitoring the system, you should be able to handle larger data sizes effectively.
Regards

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.