AWS IOT example not working, plz help

Hi

I tried your AWS IOT example “Controlled publish period”, and for some reason I get these two errors:

IOError @[0077:0016:00BD:007D:00BC:0025:00EB:0031]
Thread 1 exited with exception IndexError @[00C6:000E:00BD:03CA:00BC:0025:00EB:0031]

and when I click on both errors, I get this stack dump respectively in the Zerynth Studio

IOError at line 93 of aws.iot.iot.connect
raised at line 394 of mqtt.mqtt.connect
raised at line 411 of mqtt.mqtt._connect
raised at line 250 of socket.settimeout

Thread 1 exited with exception IndexError at line 93 of aws.iot.iot.connect
raised at line 394 of mqtt.mqtt.connect
raised at line 504 of mqtt.mqtt._connect
raised at line 764 of mqtt.mqtt._handle_connack

It should be noted that:

  • I followed same exact steps outlined in the video.

  • I tested the example with ESP32 & STNucleaoF429ZI boards, and I got similar error.

  • Both boards connected to internet and I receive and got IP from DHCP.

  • I tested with r2.3.3 & r2.4.0 releases, and I got the same error.

-I tested adding a dummy message from AWS console, and all is good

I wonder if there is a CLI script (or some tool) that I can test independently outside the device? I want to verify that my AWS IOT setup is all good?

Many thx in advance guys,

S. Mansour

FYI, I just did a quick Java test with the same parameters (same certificate, same private key, same endpoint and topic), and I was able to see the data on AWS IOT console for the Thing.

Thx

OK, I made progress. I was able to get it to work for ESP32, and failed with ST NucleoF429ZI. Again I got this error below. Frankly I prefer to work ST NucleoF429ZI board if possible. The board has so much power and functionality.
Thread 1 exited with exception IndexError at line 93 of aws.iot.iot.connect
raised at line 394 of mqtt.mqtt.connect
raised at line 504 of mqtt.mqtt._connect
raised at line 764 of mqtt.mqtt._handle_connack
FYI, I tried with Particle Photon and failed; it seems SSL functionality haven’t been implemented yet.

Therefore at least my AWS IOTsetup is all good and dandy, I appreciate it if you help me with this error. I suspect that there is a functionality that hasn’t been implemented yet for ST boards yet.
Many thx in advance guys,

Peace,
S. Mansour

OK, Finally I solved it

First I had to enable Zerynth SSL for the project (by adding the conditional compilation to the project.yml), however that was not enough because I got compilation errors related to mbedtls/ss.h not found. Therefore I had to copy the whole folder to /.zerynth2/dist/r2.4.0/stdlib/csrc/zsockets along with zerynth_hwcrypto.h. For some reason, it wasn’t included in the include search path
And now I am publishing. I hope this will help somebody else.
One last question, how can influence the make file? I mean how can I add I and D switches for the C/C++ compilers?

Cheers,

S. Mansour

hi @abusous2000
Sorry for the late reply.
For the ESP32, You have to enable some definitions as mentioned in the docs to use SSL.
As for the

Thanks for reporting, We’ll have a look at the search path.

If you mean compiler definitions, AFAIK the user cannot access the make file.
Why do you need those switches?

1 Like

Hi Karim,

Thx for your; very informative.

When I was trying to get AWS IOT to work with SSL, I was getting undeclared variable definitions when Zerynth was C/C++ compiling mbed stuff. And when I physically copied them, it worked; see my earlier reply for the details.

Therefore, if I can direct the search path some how in the project.yml file; copying would not be necessary.

Also I would like to store some libraries outside of your distribution folder; and such a flag would be very helpful. I don’t like polluting your code guys!

S. Mansour

I am having the exact same issue but I’m not quite at the skill level required to execute the solution described above. Can someone please help me with this:

“First I had to enable Zerynth SSL for the project (by adding the conditional compilation to the project.yml), however that was not enough because I got compilation errors related to mbedtls/ss.h not found. Therefore I had to copy the whole folder to /.zerynth2/dist/r2.4.0/stdlib/csrc/zsockets along with zerynth_hwcrypto.h.”

Thank you in advance.

Hi,

I’m not sure if you are using the same board; I’m using ST NucleoF429ZI
Anyhow, this bug was related to r2.4.0, which i think was fixed in r.2.4.2 (although I am not sure, I haven’t tested it). However, to make it work…your project.yml should contain the following to enable SSL:

config:
ZERYNTH_SSL: true

So if you are not on r2.4.2, I recommend upgrading 1st!

Anyhow, if you still replicate the same error, what I did that I copied this folder and file from

$HOME/.zerynth2/dist/r2.4.0/stdlib/csrc/tls/mbedtls/include/mbedtls
$HOME/.zerynth2/dist/r2.4.0/stdlib/csrc/tls/mbedtls/include/zerynth_hwcrypto.h
To

$HOME/.zerynth2/dist/r2.4.0/stdlib/csrc/zsockets

It should be noted that the above was with r2.4.0

And it worked for me after I enabled SSL for the whole project

Good luck

I’ll give it a try, thank you so much!