MQTT buffer size not working after 7500 bytes

gomez9656
Posts: 28
Joined: Mon Mar 14, 2022 7:48 pm

MQTT buffer size not working after 7500 bytes

Postby gomez9656 » Mon Jan 27, 2025 8:38 pm

I'm working with an ESP32 in Platformio using the Arduino framework and the ESP-IDF MQTT (mqtt_client.h) implementation. platform = espressif32 @ 6.9.0

The broker is AWS IoT Core. So far I've been able to do the provisioning process and send data back and forth without problem.

The problem is I need to be able to receive 15kB in the payload, but if I set the buffer size greater than 7500 bytes, the client is not able to connect.

Error is:

Code: Select all

Other event id:
0
E (18401) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x2880
E (18402) esp-tls: Failed to open new connection
E (18403) TRANSPORT_BASE: Failed to open a new connection
E (18409) MQTT_CLIENT: Error transport connect
MQTT_EVENT_ERROR
MQTT_EVENT_DISCONNECTED
I also tried increasing the MQTT task size, but that didn't work.

This is the specific code:

Code: Select all

    esp_mqtt_client_config_t aws_mqtt_cfg = {
        .event_handle = mqtt_event_handler,
        .uri = "xxxxxxxxxxxx",
        .port = SERVER_PORT,
        .client_id = "xxxxxxxx",
        //.task_stack = 12000,
        .buffer_size = 7500,
        .cert_pem = AWS_CERT_CA,
        .client_cert_pem = AWS_CERT_CA_new,
        .client_key_pem = AWS_CERT_PRIVATE_new,
    };
I checked the heap size before connecting and there's around 80kB free to use, so that shouldn't be the problem. I also tried looking for the max mqtt buffer size but didn't find any rule about it.

Thanks a lot in advance :)

Who is online

Users browsing this forum: Amazon [Bot], Baidu [Spider], Barkrowler and 4 guests