This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM2434: Increase MQTT Payload Size

Part Number: AM2434

Hello Team,

From the enet_lwip_icssg, I enabled MQTT and added source code to connect with server.  I'm interested in sending (publishing) packets up to 8KB. However, when I increase the packet size past 2KB, the message will not publish to the server. Without modifying the SDK, the user can publish up to 256B. To increase the size, I increased the MQTT_RINGBUF_SIZE from 128 to 2048, then rebuilt the following libraries (8_04_17 SDK). 

FYI, here are the libraries that need to be rebuilt:

gmake -s -f makefile.am243x enet-lwip-icssg_r5f.ti-arm-clang
gmake -s -f makefile.am243x lwip-freertos_r5f.ti-arm-clang
gmake -s -f makefile.am243x lwip-contrib_r5f.ti-arm-clang

With the mentioned changes, I was able to send around 2048 bytes. I tried to further increase the MQTT_OUTPUT_RINGBUF_SIZE to 4096, but received this error in mem.c:

"mem_malloc(): no pool is that big!"
I checked the pools in lwippools.h and saw that there are pools large enough, tried adding more pools (50 pools of size 4096) and increasing pool size to 8K, but this didn't fix the issue.
Can you please share how I can further increase the MQTT packetsize? 
Thank you in advance!
  • Hi Alex,

    Let me get back on it by tomorrow

    BR

  • Hi Alex,

    if you increase the MQTT_OUTPUT_RINGBUF_SIZE  to 8192, you need to add one pool with this definition LWIP_MALLOC_MEMPOOL(1, 8560) in order to have a suitable memory pool available.

    Best regards,

    Steffen

  • Hi Steffen,

    Thank you for the input. I assume I received this error since I was not accounting for the topic, hence the overall message size would be slightly larger than the pool sizes I was creating.  Now, I do not receive the error that I was previously receiving. 

    However, I keep getting disconnected when I try and publish more than 1KB payloads. I figured this was happening because there was minimal delay between publishes, but even after adding vTaskDelay(x) and varying the value of x from 1 to 10000, I still was not able to fix the issue. Do you have any recommendations?

    Best regards,

    Alex Walton