Coder Social home page Coder Social logo

jankammerath / l475vg-iot01a-mbed-aws-iot Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 6.0 22 KB

AWS IoT client for ARM Mbed OS on the STMicroelectronics STM32L4 Discovery Kit IoT Node

License: Apache License 2.0

C++ 53.08% C 46.92%
iot stm32 aws aws-iot mqtt mbed mbed-os mbedtls mbedos amazon-web-services aws-cloud mqtt-connector mqtt-client arm tls wifi c cpp ntp iot-application

l475vg-iot01a-mbed-aws-iot's Introduction

AWS IoT with the L475VG-IOT01A on Mbed OS

An application for the STMicroelectronics STM32L4 Discovery Kit IoT Node using ARM Mbed OS to connect to AWS IoT cloud. In parts it is inspired by the example AWS IoT from Mbed OS device using the Wifi and sensor example from Team ST. Although specifically built for the IOT01A-model, it should be compatible with the Non-US IOT01B-model.

Intended use of this program code

I built the program as I was unable to connect the STM32L4 to the AWS IoT cloud with any existing examples or libraries. I provide it on an AS IS basis for anyone that wants to get ahead faster with the STM32, ARM Mbed and AWS IoT. Therefore the intended user of this program should bring some basic C/C++ knowledge.

How to install the program on a STM32 L475VG-IOT01A

In order to run the program on your STM32L475, you need to configure and compile it. I will explain the process using the Mbed online compiler for which you need to create a free account on os.mbed.com. Further you need to have an AWS account to create AWS IoT things.

Import the program into the Mbed compiler

Make sure you are logged in to your mbed.com account. You can easily import the program into the mbed online compiler using the following link: Import the program into the compiler. You will afterwards see the program and it's code components, just as on GitHub.

Configure your AWS certificate and key

You will need the certificate and the private key that AWS IoT created for your thing as well as the endpoint that can be found in the Settings section of AWS IoT. These information need to be inserted into the corresponding sections inside the configuration file MQTT_server_setting.h.

const char MQTT_SERVER_HOST_NAME[] = "INSERT_THING_ENDPOINT_HERE.iot.eu-central-1.amazonaws.com";

const char* SSL_CLIENT_CERT_PEM = "-----BEGIN CERTIFICATE-----\n"
"INSERT YOUR THING CERTIFICATE HERE!\n"
"-----END CERTIFICATE-----\n";

const char* SSL_CLIENT_PRIVATE_KEY_PEM = "-----BEGIN RSA PRIVATE KEY-----\n"
"INSERT YOUR THING PRIVATE KEY HERE!\n"
"-----END RSA PRIVATE KEY-----\n";

Once changed the application is ready to compile. The compiler will provide you a bin-file that you can easily copy onto your STM32L4. The program outputs several debug information, so in case it fails you will be able to track the issue through the console.

l475vg-iot01a-mbed-aws-iot's People

Contributors

jankammerath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

l475vg-iot01a-mbed-aws-iot's Issues

Error Codes

IoT device starting
WIFI is now connected
[INFO][TLSW]: mbedtls_ssl_conf_ca_chain()
[INFO][TLSW]: mbedtls_ssl_config_defaults()
[INFO][TLSW]: mbedtls_ssl_conf_authmode()
MQTT network not successful
IoT device starting
WIFI is now connected
[INFO][TLSW]: mbedtls_ssl_conf_ca_chain()
[INFO][TLSW]: mbedtls_ssl_config_defaults()
[INFO][TLSW]: mbedtls_ssl_conf_authmode()
[INFO][TLSW]: mbedtls_ssl_conf_rng()
[INFO][TLSW]: mbedtls_ssl_setup()
[INFO][TLSW]: Starting TLS handshake with a1uafk5grkgw0y-ats.iot.eu-west-2.amazonaws.com
[INFO][TLSW]: TLS connection to a1uafk5grkgw0y-ats.iot.eu-west-2.amazonaws.com established

[DBG ][TLSW]: Server certificate:
cert. version : 3
serial number : 01:49:67:29:7A:21:20:F7:2B:22:E6:FE:F6:78:3C:83
issuer name : C=US, O=Amazon, OU=Server CA 1B, CN=Amazon
subject name : CN=*.iot.eu-west-2.amazonaws.com
issued on : 2019-05-07 00:00:00
expires on : 2020-04-26 12:00:00
signed using : RSA with SHA-256
RSA key size : 2048 bits
basic constraints : CA=false
subject alt name : iot.eu-west-2.amazonaws.com, *.iot.eu-west-2.amazonaws.com
key usage : Digital Signature, Key Encipherment
ext key usage : TLS Web Server Authentication, TLS Web Client Authentication

[INFO][TLSW]: Certificate verification passed
[DBG ][TLSW]: send 44
[ERR ][TLSW]: Socket recv error -3016
[ERR ][TLSW]: mbedtls_ssl_read() failed: -0x0bc8 (-3016): UNKNOWN ERROR CODE (0B80) : UNKNOWN ERROR CODE (0048)
MQTT client failed

Hello, I'm getting this error and not sure what to do, can you help me out? here or possibly email me at [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.