STM32L4: Need code to get sensor data, and send it to IoT Core via MQTT

MCUnew wrote on May 10, 2019:

What I need here is help developing some simple sample code which can read in sensor data (in this case, temperature data) from the STM32L4 Development Board and then send this to AWS IoT Core via the messaging protocol.

My team has been able to provision WiFi credentials to the board through the ‘aws_clientcredential.h’ file and send simple MQTT messages to the core. Our strategy thus far has been to modify the file ‘aws_hello_world.c’ file that’s provided in the a:FreeRTOS download package, as was done in this AWS training video [https://www.aws.training/learningobject/wbc?id=33191]. But nowhere can I find a simple tutorial that provides simple code for interacting with a sensor on the board–and to be honest, we aren’t exactly sure that editing the hello world script was the right thing to do either.

So what is the best way to go about doing this? Any help would be greatly appreciated.

Edited by: MCUnew on May 10, 2019 10:24 AM

DanN-AWS wrote on May 23, 2019:

Amazon FreeRTOS does not yet support a general API to handle peripherals such as SPI, Serial, GP I/O, I2C, etc… that you may need to use to communicate with your sensors. The best approach at this time is to use the SDK provided by the Silicon Vendor (in this case ST) to interact with the sensors. The SDK for your board is available from Amazon FreeRTOS github repo under the mcu_vendor folder, please see here: https://github.com/aws/amazon-freertos/tree/master/lib/third_party/mcu_vendor. You may need to modify the project file for your board to add the drivers and headers you need. Once you have access to the data on your ST based embedded device, you can use MQTT to publish the data to IoT Core and take action as appropriate.