ESP32 S3: How to increment internal espressif parameter in arduino framework

Hi,

I’ve a Freenove ESP32-S3-WROOM and I’m working in a project where the main idea is that, when it detects some movement, starts CAM recording and, after the recording, upload the AVI file to an online server (uptoBox premium account). I’m working with platformio and Arduino framework.

The issue I’m having it’s that, the last part (upload the file to the server), it takes too much time. In example, one of my tests took 41 seconds to upload a 3’4 MB file.

I’m not sure if this can be related to the CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN parameter (TLS maximum message content length), that is defined to 16384 as maximum, so that’s the maximum chunk I can send in one “write” operation.

The platformio.ini:

[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
build_flags = 
	-DBOARD_HAS_PSRAM
	-DCORE_DEBUG_LEVEL=4
board_build.arduino.memory_type = qio_opi
monitor_speed = 115200
upload_speed = 921600
board_upload.flash_size = 8MB
lib_deps = bblanchon/ArduinoJson@^6.21.2

This is a briefly summary of how I’m sending the file:

#define BYTESENVIO 16384
...
...

char *buffer = (char *)ps_malloc(BYTESENVIO * sizeof(char));
size_t tamFic = myFile.size(); // Tamaño total del fichero
size_t tamSiguiente = myFile.readBytes(buffer, BYTESENVIO); // Leemos primeros bytes y los almacenamos en el buffer
size_t totalEnviado = 0;                                    // Almacenamos aquí el número de bytes que hemos enviado

// Enviamos el fichero al servidor
    while (totalEnviado < tamFic)
    {
      client.write_P((const char *)(buffer), tamSiguiente); // Enviamos el buffer al servidor
      totalEnviado += tamSiguiente;                         // Aumentamos el contador de bytes enviados al servidor
      tamSiguiente = myFile.readBytes(buffer, BYTESENVIO); // Seguimos leyendo el fichero y almacenamos en el buffer
    }

If I try to send more than 16384 bytes in one write operation, then the file is not uploaded correctly (the final size of the file uploaded is not what I expect). It works fine if I use 16384 as max.

I’m making use of the 8MB of PSRAM that this board has (using the ps_malloc method), so as I have 8MB that can be used, I think I could increase the CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN to increase the max bytes I can send in one write operation, and see if this increases the upload speed.

But I don’t know how to change this parameter CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN, as never did it before. Also, may be this shouldn’t be the solution.

Can this be done in Arduino framework? How?

Any thoughts will be appreciated :slight_smile:
Thanks!!