I program in the environment Platformio.
I’m trying to run MQTT through a cloud broker, since cloud brokers use TLS connection, I have to use this. When I tried to do this, I got an error:mqtt_client: Secure element not enabled for esp-tls in menuconfig.
I set CONFIG_ESP_TLS_USE_SECURE_ELEMENT=y but now I get another error: platformio\packages\framework-espidf\components\esp-tls\esp_tls_mbedtls.c:33:10: fatal error: mbedtls/atca_mbedtls_wrap.h: No such file or directory
My code for mqtt init:
esp_mqtt_client_handle_t MQTT_HANDLE;
esp_err_t err;
size_t len_certificate;
esp_mqtt_client_config_t cfg_mqtt = {0};
len_certificate= 0;
len_certificate = strlen(certificate);
ESP_LOGE(TAG, “Len cetificate:[%i]”,len_certificate);
cfg_mqtt.broker.address.uri = "mqtts://url.eu.hivemq.cloud";
cfg_mqtt.broker.address.port = 8883;
cfg_mqtt.credentials.authentication.certificate = certificate;
cfg_mqtt.credentials.authentication.certificate_len = len_certificate;
cfg_mqtt.credentials.username = "userName";
cfg_mqtt.credentials.authentication.use_secure_element = true;
MQTT_HANDLE = esp_mqtt_client_init(&cfg_mqtt);
if(MQTT_HANDLE == NULL) ESP_LOGE(TAG,"ERROR MQTT_HADNLE");
vTaskDelay(1000/portTICK_PERIOD_MS);
esp_mqtt_client_register_event(MQTT_HANDLE, MQTT_EVENT_ANY,
mqtt_event_handler, NULL);
err = esp_mqtt_client_start(MQTT_HANDLE);
ESP_LOGE (TAG, “MQTT_START = %d %s”, err, esp_err_to_name(err));
How to use SSL of esp32!!!
I initially tried the Platform through the framework Arduino, but since there is no way to configure the IDF, I decided to use only the IDF framework, well, and here are the problems, I’m tired of fighting with all this SSL shit!