79398366

Date: 2025-01-29 22:48:06
Score: 1.5
Natty:
Report link

I have been experimenting some difficultities around this problem

My code has a function to configure the modem and I have tried all that has been said in this forum

I am using MQTT via LTE-M and my configuration for AWS is this one

#define MQTT_BROKER "#######.iot.us-east-1.amazonaws.com" 
#define MQTT_PORT 8883                                            
#define MQTT_TOPIC "sdk/test/python"  

I included the keys and certificates as const * char

void configureModem() {

  // Inicializar sistema de archivos
  modem.sendAT("+CFSINIT");
  if (modem.waitResponse() != 1) {
    Serial.println("Error al inicializar el sistema de archivos");
    return;
  }

  // Subir certificados
  modem.sendAT("+CFSWFILE=3,\"rootCA.crt\",0,", strlen(rootCA_cert_pem), ",10000");
  if (modem.waitResponse(10000, "DOWNLOAD") == 1) {
    modem.stream.write(rootCA_cert_pem);
  }
  modem.waitResponse(5000);

  modem.sendAT("+CFSWFILE=3,\"client.crt\",0,", strlen(client_cert_pem), ",10000");
  if (modem.waitResponse(10000, "DOWNLOAD") == 1) {
    modem.stream.write(client_cert_pem);
  }
  modem.waitResponse(5000);

  modem.sendAT("+CFSWFILE=3,\"client.key\",0,", strlen(client_key_pem), ",10000");
  if (modem.waitResponse(10000, "DOWNLOAD") == 1) {
    modem.stream.write(client_key_pem);
  }
  modem.waitResponse(5000);

  // Convertir certificados
  modem.sendAT("+CSSLCFG=\"CONVERT\",2,\"rootCA.crt\"");
  modem.waitResponse(5000);

  modem.sendAT("+CSSLCFG=\"CONVERT\",1,\"client.crt\",\"client.key\"");
  modem.waitResponse(5000);

  // Configurar certificados SSL
  modem.sendAT("+SMSSL=1,\"rootCA.crt\",\"client.crt\"");
  modem.waitResponse(3000);

  // Finalizar sistema de archivos
  modem.sendAT("+CFSTERM");
  modem.waitResponse();

  // Configurar MQTT
  modem.sendAT("+SMCONF=\"URL\",\"" MQTT_BROKER "\",8883");
  modem.waitResponse();

  modem.sendAT("+SMCONF=\"CLIENTID\",\"SIM7080_Client\"");
  modem.waitResponse();

  modem.sendAT("+SMCONF=\"KEEPTIME\",60");
  modem.waitResponse();

  modem.sendAT("+SMCONF=\"CLEANSS\",1");
  modem.waitResponse();

  modem.sendAT("+SMCONF=\"QOS\",1");
  modem.waitResponse();

  // Consultar configuración MQTT
  modem.sendAT("+SMCONF?");
  modem.waitResponse(5000);

  // Conectar a MQTT
  modem.sendAT("+SMCONN");
  if (modem.waitResponse(10000) == 1) {
    Serial.println("MQTT conectado exitosamente.");
  } else {
    Serial.println("Error al conectar MQTT.");
  }

  return;
}

When I try to connect or publish, it does not work. I tried using legacy rootCA, tls 1.2 and the default topics but it is still not working

Reasons:
  • Blacklisted phrase (2): still not working
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Anthony Chaves