How to port AWS FreeRTOS into Nordic nRF52840

inghowe83 wrote on April 25, 2018:

Hi There,

How can I port AWS FreeRTOS into Nordic nRF52840? I notice the current AWS FreeRTOS only support Microship, ST, NXP and etc.

And I plan to use bluetooth <-> IOS mobile <-> AWS IoT. What are the benefit if I use AWS FreeRTOS vs standard FreeRTOS? As most of the feature (OTA, MQTT Agent, Wifi Management Library, Shadow Library, Greengrass only support WIFI MQTT rather than BLE). And I not sure how the the local connectivity feature provided by Greengrass can benefit the device to manage data .

https://aws.amazon.com/freertos/features/

I did found some portin guide on the AWS website but the info are limit to newbie like me.
https://docs.aws.amazon.com/freertos/latest/userguide/porting-guide.html

inghowe83 wrote on April 26, 2018:

Hi,

Thanks for your input. Good to heard that AWS team is prioritize BLE support, may I know when BLE will be support? If possible any specific dateline?

We original plan is to establish connection between our device to cloud through ble with phone act as a mqtt router. But AWS FreeRTOS doesn’t support BLE, but we still thinks that aws freertos would help us manage some local device data and put in a device shadow json format using the device shadow aws lib. We will then send the shadow json via ble to our mobile app and the mobile app will establish linkage with AWS IoT and sync the device shadow json with the AWS device shadow. And the second benefit we think of is to use the Local Resource Access to enable remote debugging through AWS Cloud, but we no sure how we can hack the aws freertos existing code to allow device shadows clone feature through BLE.

If our idea might works, we would hope to get technical guideline from aws on how could we establish workable device shadow data structure on our device while trying to sent the device shadow parameters to mobile app using nordic ble(not mqtt). Mobile app will convert those parameters back to AWS IoT mqtt msg.

I did look through the \lib\secure_sockets\portable\microchip\curiosity_pic32mzef\aws_secure_sockets.c and I notice the secure socket is design for ethernet and wifi. If I managed to port the socket, wifi and other AWS FreeRTOS lib, we still won’t able to use any of those feature as all those feature require mqtt connection. So, we still trying to figure ways to bring nordic softdevices BLE into aws freertos and only run the device shadow aws lib, default freertos and nordic ble.

And thanks for the greengrass guideline, I found out its like a hosted local server which we don’t need this feature.

Edited by: inghowe83 on Apr 25, 2018 5:30 PM

Edited by: inghowe83 on Apr 25, 2018 7:32 PM

Tiangang-AWS wrote on April 25, 2018:

Hi,

Thanks for your interest in Amazon FreeRTOS! The most important part of porting is connectivity (WiFi and sockets layer) and security (TLS), other libraries such as MQTT, Shadow and Greengrass are built on top of them. Basically, you need to wrap your driver code into interfaces defined in the corresponding header file, e.g., +lib/include/aws_secure_sockets.h+. I would recommend to try get sockets working as the first step. A good reference is our existing porting layer code such as, +lib/secure_sockets/portable/ti/cc3220_launchpad/aws_secure_sockets.c+.

The benefit of Amazon FreeRTOS is that it provides already well developed and tested libraries for you to use instead of building your own. Your device can talk to AWS IoT directly and you can focus on your application code. As for local connectivity features provided by Greengrass, could you provide more details of your use case? Here’s the list of features that Greengrass provides, [https://aws.amazon.com/greengrass/features/]

And as you already noticed, we don’t support BLE currently. Our team values your opinion and we will use it in our consideration for prioritization on our support for BLE.

Thanks,
Tiangang

Tiangang-AWS wrote on April 27, 2018:

Hi,

Thanks for sharing your use case. As a general rule, we typically don’t share our roadmap on forum.

So it looks like you’re trying to put cloud communication logic on your mobile app, and the app will talk to the device via BLE right? In this case, we do have AWS SDK for iOS, which could help you with device shadow management. You might also want to take a look at this sample, [https://github.com/awslabs/aws-sdk-ios-samples/tree/master/IoTTemperatureControl-Sample/Swift/IoTTemperatureControlSample].

On the device side, I would suggest only using a json library and plain FreeRTOS since device shadow is just a json document. You can check how to construct a valid shadow document here, [https://docs.aws.amazon.com/iot/latest/developerguide/device-shadow-document.html]. You can even delegate this to your mobile app if you want, then you don’t need any json library at all, the device would send the required parameters via BLE to your mobile app as you described. What the shadow library in Amazon FreeRTOS does is to help you with MQTT connection part, it takes the thing name (which is needed for MQTT topic) and the json document as input parameters, then talks to AWS IoT via MQTT.

The idea of Amazon FreeRTOS is to make it easy for developers to develop cloud based applications on microcontrollers. This way, the device can operate by itself and talks to the cloud directly, and you can build most part of your application logic inside the mcu. In your specific use case, I don’t see you would benefit a lot from using our libraries, I do wish we already have BLE support for you though. :slight_smile:

Thanks,
Tiangang