ESP32-C3 Supermini AWS Integration Issue, TLS_MUTUAL_Auth Example SDK

Mahadi Hasan
Posts: 1
Joined: Sat Aug 03, 2024 7:40 am

ESP32-C3 Supermini AWS Integration Issue, TLS_MUTUAL_Auth Example SDK

Postby Mahadi Hasan » Sat Aug 03, 2024 7:51 am

I have Flashed the Program successfully to my ESP32-C3 Supermini module. The following error requires your kind attention and solution
I (2273528) coreMQTT: An MQTT session with broker is re-established. Resending unacked publishes.
I (2273538) coreMQTT: Subscribing to the MQTT topic /example/topic.
I (2273548) coreMQTT: SUBSCRIBE sent for topic /example/topic to broker.

E (2273728) coreMQTT: Call to receiveSingleIteration failed. Status=MQTTRecvFailed
E (2273728) coreMQTT: MQTT_ProcessLoop failed to receive ACK packet: Expected ACK Packet ID=121, LoopDuration=181, Status=MQTTRecvFailed

I (2273738) coreMQTT: Disconnecting the MQTT connection with a2ymunmj15xks7-ats.iot.ap-south-1.amazonaws.com.
I (2273748) coreMQTT: Disconnected from the broker.
I (2273758) coreMQTT: Short delay before starting the next iteration…

I (2278768) coreMQTT: Establishing a TLS session to a2ymj15xks7-ats.iot.ap-south-1.amazonaws.com:8883.
I (2281608) coreMQTT: MQTT connection established with the broker.
I (2281608) coreMQTT: MQTT connection successfully established with broker.

Is this because of the mis configured IOT policy or Something else. I think the error log is coming from this part of the code as follows :

Code: Select all

static int waitForPacketAck( MQTTContext_t * pMqttContext,
uint16_t usPacketIdentifier,
uint32_t ulTimeout )
{
uint32_t ulMqttProcessLoopEntryTime;
uint32_t ulMqttProcessLoopTimeoutTime;
uint32_t ulCurrentTime;

MQTTStatus_t eMqttStatus = MQTTSuccess;
int returnStatus = EXIT_FAILURE;

/* Reset the ACK packet identifier being received. */
globalAckPacketIdentifier = 0U;

ulCurrentTime = pMqttContext->getTime();
ulMqttProcessLoopEntryTime = ulCurrentTime;
ulMqttProcessLoopTimeoutTime = ulCurrentTime + ulTimeout;

/* Call MQTT_ProcessLoop multiple times until the expected packet ACK
 * is received, a timeout happens, or MQTT_ProcessLoop fails. */
while( ( globalAckPacketIdentifier != usPacketIdentifier ) &&
       ( ulCurrentTime < ulMqttProcessLoopTimeoutTime ) &&
       ( eMqttStatus == MQTTSuccess || eMqttStatus == MQTTNeedMoreBytes ) )
{
    /* Event callback will set #globalAckPacketIdentifier when receiving
     * appropriate packet. */
    eMqttStatus = MQTT_ProcessLoop( pMqttContext );
    ulCurrentTime = pMqttContext->getTime();
}

if( ( ( eMqttStatus != MQTTSuccess ) && ( eMqttStatus != MQTTNeedMoreBytes ) ) ||
    ( globalAckPacketIdentifier != usPacketIdentifier ) )
{
    LogError( ( "MQTT_ProcessLoop failed to receive ACK packet: Expected ACK Packet ID=%02"PRIx16", LoopDuration=%"PRIu32", Status=%s",
                usPacketIdentifier,
                ( ulCurrentTime - ulMqttProcessLoopEntryTime ),
                MQTT_Status_strerror( eMqttStatus ) ) );
}
else
{
    returnStatus = EXIT_SUCCESS;
}

return returnStatus;
}
E (2273728) coreMQTT: Call to receiveSingleIteration failed. Status=MQTTRecvFailed

This error is generating from following function:

Code: Select all

static MQTTStatus_t receiveSingleIteration(MQTTContext_t pContext,
uint32_t remainingTimeMS,
bool manageKeepAlive)
Both the cases the document reads it is something to do with a network error. I was wondering is it mis configuring of AWS policy or something else? kindly share any solution.
thanks.

Who is online

Users browsing this forum: No registered users and 331 guests