Hello to everyone, I'm really in trouble trying to connect to AWS.
with the command AT+SYSMFG formatted as follows, I donwloaded the certificates :
snprintf(cmd, sizeof(cmd), "AT+SYSMFG=%u,\"mqtt_ca\",\"mqtt_ca.0\",%lu,%lu\r\n", 2, 8,len);
snprintf(cmd, sizeof(cmd), "AT+SYSMFG=%u,\"mqtt_cert\",\"mqtt_cert.0\",%lu,%lu\r\n", 2, 8,len);
snprintf(cmd, sizeof(cmd), "AT+SYSMFG=%u,\"mqtt_key\",\"mqtt_key.0\",%lu,%lu\r\n", 2, 8,len);
where len is the output of strlen of strings pem files , for example :
const char server_amazon_pem[] =
"-----BEGIN CERTIFICATE-----\n"
"MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsF\n"
"ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6\n"
"b24gUm9vdCBDQSAxMB4XDTE1MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTEL\n"
"MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv\n"
"b3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJ4gHHKeNXj\n"
"ca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgHFzZM\n"
"9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qw\n"
"IFAGbHrQgLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6\n"
"VOujw5H5SNz/0egwLX0tdHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L\n"
"93FcXmn/6pUCyziKrlA4b9v7LWIbxcceVOF34GfID5yHI9Y/QCB/IIDEgEw+OyQm\n"
"jgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC\n"
"AYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3DQEBCwUA\n"
"A4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDI\n"
"U5PMCCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUs\n"
"N+gDS63pYaACbvXy8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vv\n"
"o/ufQJVtMVT8QtPHRh8jrdkPSHCa2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU\n"
"5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2xJNDd2ZhwLnoQdeXeGADbkpy\n"
"rqXRfboQnoZsG4q5WTP468SQvvG5\n"
"-----END CERTIFICATE-----";
After I send the sequence :
esp32_uart_send("AT+CIPSNTPCFG=1,1,\"0.pool.ntp.org\",\"time.google.com\"\r\n");
esp32_uart_wait_response("OK",500,NULL);
esp32_uart_send("AT+CIPSNTPTIME?\r\n");
esp32_uart_wait_response("OK",500,"OK");
esp32_uart_send("AT+SYSLOG=1\r\n");
esp32_uart_wait_response("OK",500,NULL);
snprintf(cmd, sizeof(cmd),"AT+MQTTUSERCFG=0,5,\"cdbkr_exel\",\"\",\"\",0,0,\"\"\r\n");
esp32_uart_send(cmd);
esp32_uart_wait_response("OK",500,NULL);
esp32_uart_send("AT+MQTTSNI=0,\"a2zo9isj8qsct0-ats.iot.eu-central-1.amazonaws.com\"\r\n");
esp32_uart_wait_response("OK",500,NULL);
esp32_uart_send("AT+MQTTCONN=0,\"a2zo9isj8qsct0-ats.iot.eu-central-1.amazonaws.com\",8883,1\r\n");
esp32_uart_wait_response("OK",500,NULL);
the command AT+MQTTCONN reponse error with err code : 0x010A6021 with or without the certificates.
Could you help me?
Thank you!
BR,
Lucio.
ESP32c3 MQTT certificate issue
Re: ESP32c3 MQTT certificate issue
You should use the `mqtt_ca`, `mqtt_cert`, `mqtt_key` as the namespace and keys. Other than `mqtt_ca.0`, `mqtt_cert.0`, `mqtt_key.0`.
You can query its value by the command like: `AT+SYSMFG=1,"mqtt_ca","mqtt_ca"` Once you changed done.
You can query its value by the command like: `AT+SYSMFG=1,"mqtt_ca","mqtt_ca"` Once you changed done.
Who is online
Users browsing this forum: Bytespider and 1 guest
