FreeRtos sample for STM32_L475E_IOT01A cannot establish connection

0

I'm using STM32 L475E_IOT01A2 and I tried to run the sample "Connect to AWS IoT - STM32-B-L475E-IOT01A", however, it always failed to establish the connection. Actually, it always returned secureSocketStatus=-1.
Actual message observed on the screen is attached below.

1 535 [Tmr Svc] Waiting for 180 seconds before generating key-pair
2 180541 [Tmr Svc] WiFi firmware version is: C3.5.2.7.STM
3 180546 [Tmr Svc] WiFi firmware is up-to-date.
4 180552 [iot_thread] [INFO ][DEMO][180552] ---------STARTING DEMO--------- 5 180560 [iot_thread] [INFO ][INIT][180559] SDK successfully initialized.
6 185637 [iot_thread] [INFO ][DEMO][185637] Successfully initialized the demo. Network type for the demo: 1
7 185647 [iot_thread] [INFO] Creating a TLS connection to a26800ryr2bs98-ats.iot.ap-northeast-1.amazonaws.com:8883.
8 185739 [iot_thread] [ERROR] Failed to establish new connection. secureSocketStatus=-1.
9 185753 [iot_thread] [WARN] Connection to the broker failed. Attempting connection retry after backoff delay.
10 186056 [iot_thread] [INFO] Retry attempt 2 out of maximum retry attempts 5.
(I omit following message just indicating repetitions.)

I think configuration for aws_clienetcredential_keys.h and aws_clientcredential.h is ok. In aws_clienetcredential_keys.h, keyCLIENT_CERTIFICATE_PEM and keyCLIENT_PRIVATE_KEY_PEM are provided as created by CertificateConfigurator. In aws_clientcredential.h, BROKER_ENDPOINT, IOT_THING_NAME, wifi address and password are set properly. In aws_demo_config, CONFIG_CORE_MQTT_MUTUAL_AUTH_DEMO_ENABLED is defined.

Further, I checked and found the problem may exist the handshake of ES_WIFI_StartClientConnection. (Observed handshake sequence is below.) Cmd:P0=0 -> ret=0, Cmd:P1=3 -> ret=0, Cmd:P2=0 -> ret=0, Cmd:P3=(remote IP address) -> ret=0, Now, ES_WIFI_STATUS & TCP_SSL_CONNECTION are ok. Cmd:P9=2 -> ret=0, Cmd:P6=1 -> ret=5, which I think means UNEXPECTED_CLOSED_SOCKET I think it leads to ecureSocketStatus=-1. I repeated many times, however, the result was always the same.

Please let me know how to solve this. As I'm really a beginner, your instruction would be highly appreciated.

regards,

CK

Additonal Information: I downloaded latest sample module from AWS site. Also, I updated wifi firmware module(SPI_C3.5.2.7) through Inventek website.

已提问 2 年前474 查看次数
1 回答
0

Hi CK. I have this particular board. Yes, the WiFi socket connection is being closed unexpectedly. What have you setup in IoT Core? I suspect the issue is probably in the cloud configuration. Is the device certificate registered and activated? Do you have an IoT policy attached to it that permits connection? Could you perhaps share the policy here?

I'm not clear what instructions you're following from the name "Connect to AWS IoT - STM32-B-L475E-IOT01A". Can you please paste the link?

UPDATE: the logs show that a new cert/key is being auto provisioned after 180s. These values will be used in preference to the values configured in aws_clientcredential_keys.h. Therefore the device is attempting connection with a different certificate than the one that has been registered in IoT Core. Hence the failure. I tested the demo on my board - it works fine and does not do the auto provisioning by default. Please check your build settings (as detailed in the comments) and re-build your binary.

profile pictureAWS
专家
Greg_B
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则