I have been following the getting started guide and trying to run the demo but without success. All I have got in the console is handshake failed as the following
0 0 [Tmr Svc] Starting Wi-Fi Module …
1 0 [Tmr Svc] Simple Link task created
Device came up in Station mode
2 162 [Tmr Svc] Wi-Fi module initialized.
3 175 [Tmr Svc] Write certificate…
4 283 [Tmr Svc] Write device private key…
5 800 [Tmr Svc] Write certificate…
[WLAN EVENT] STA Connected to the AP: xxxxx , BSSID: d0:17:c2:d7:32:f8
[NETAPP EVENT] IP acquired by the device
Device has connected to xxxxx
Device IP Address is 192.168.16.196
6 2130 [Tmr Svc] Wi-Fi connected to AP xxxxx.
7 2131 [Tmr Svc] IP Address acquired xxx.xxx.xx.xxx
8 2134 [Tmr Svc] Security alert threshold = 15
9 2134 [Tmr Svc] Current number of alerts = 0
10 2134 [Tmr Svc] Creating MQTT Echo Task…
11 2134 [MQTTEcho] MQTT echo attempting to connect to xxxxxxxxxxxxx-ats.iot.ap-northeast-1.amazonaws.com.
12 2387 [pthread] [SimpleLinkSockEventHandler ERROR]: Handshake Failed - socket 0, reason: -457.
13 2388 [MQTTEcho] ERROR: MQTT echo failed to connect with error 1.
14 2388 [MQTTEcho] MQTT echo test could not connect to broker.
15 2409 [MQTTEcho] MQTT echo demo finished.
16 2409 [MQTTEcho] ----Demo finished----
does anyone know what reason: -457 indicate? Any advice?
Thank you for reply.
My CA is hard coded in \AmazonFreeRTOS\lib\include\private\aws_default_root_certificates.h, and certificates were downloaded from AWS, so I assume they are valid.
Hi lph65724
Sorry to hear that the demo is not working for you.
The error comes from TI networking processor, and it relates to either the certificate format is wrong or there was a failure writing the certificate to the File System.
Known reasons for the error is documented in TI programmers guide here:http://www.ti.com/lit/ug/swru455g/swru455g.pdf
Could you confirm if you generated the header file (aws_clientcredential_keys.h) using the Certificate configuration tool located in <Base_Folder>/tools/certificate_configuration/CertificateConfigurator.html ?
For more details on how to generate the header file, you can refer to this guide: https://docs.aws.amazon.com/freertos/latest/userguide/freertos-configure.html
It could be that the certificate DEFINE is missing newline characters at the end, or truncated.
Please let us know if the above suggestions fixed your issue.
Yes, I used Certificate configuration tool located in <Base_Folder>/tools/certificate_configuration/CertificateConfigurator.html to generate aws_clientcredential_keys.h, and each line of the certificate ends with a newline character like shown below.
I was able to run the MQTT echo demo successfully using TI CC3220 connecting to broker endpoint in ap-northeast-1 region. Here are the steps I did:
Create a thing in AWS IOT ap-northeast-1 region.
Create a certificate using “one click certificate creation”.
Activate the certificate, and download the certificate and private key to the filesystem.
Attach a valid policy to the certificate.
User CertificateConfigurator.html to generate aws_clientcredential_keys.h from the client certificate and private key and replace the original aws_clientcredenial_keys.h file with the new file.
Configure other credentials like MQTT broker endpoint, WIFI AP name and password.
Run the demo.
Here are the logs:
0 0 [Tmr Svc] Starting Wi-Fi Module …
1 0 [Tmr Svc] Simple Link task created
2 329 [Tmr Svc] Wi-Fi module initialized.
3 338 [Tmr Svc] Write certificate…
4 449 [Tmr Svc] Write device private key…
5 967 [Tmr Svc] Write certificate…
[WLAN EVENT] STA Connected to the AP: xxxxxxxx, BSSID: cc:40:d0:15:4a:3b
[NETAPP EVENT] IP acquired by the device
Device has connected to xxxxxxx
Device IP Address is 192.168.1.48
6 3304 [Tmr Svc] Wi-Fi connected to AP xxxxxx.
7 3305 [Tmr Svc] IP Address acquired 192.168.1.48
8 3308 [Tmr Svc] Security alert threshold = 15
9 3308 [Tmr Svc] Current number of alerts = 0
10 3308 [Tmr Svc] Creating MQTT Echo Task…
11 3309 [MQTTEcho] MQTT echo attempting to connect to xxxxxxxxxx-ats.iot.ap-northeast-1.amazonaws.com.
15 6211 [MQTTEcho] MQTT echo connected.
16 6211 [MQTTEcho] MQTT echo test echoing task created.
18 6614 [MQTTEcho] MQTT Echo demo subscribed to freertos/demos/echo
20 7018 [MQTTEcho] Echo successfully published ‘Hello World 0’
22 7222 [Echoing] Message returned with ACK: ‘Hello World 0 ACK’
Hmm, that is very strange. I did exactly the same procedures several times, but I never got it to work. Actually, I have also tried with ST and Espressif boards, and they both work fine. I wonder, besides downloading the service pack, if I need to configure CC3220 prior to downloading echo sample code.