How to write Amazon freeRTOS network manager for LTE?

ArjunSalariya wrote on June 5, 2020:

I am working to integrate AWS freeRTOS with LTE for custom board,i have reffred freertos programming guide as well as user guide.

By reffering freertos-pg i am able to add every stub wtih LTE for aws_test i.e. TLS,PKCS11,Sockets,MQTT but now when it comes to writing aws_demo i am not able to find how to write aws_iot_network_manager.c .

Also from freertos-ug, this network manager more focuse around wi-fi based solution so now my query is how to write this file for LTE ?

Also when i look at the predefined demos, while working with demo_runner() it has vDevModeKeyProvisioning() for provisioning, but unfortunatly i m not able to get any information regarding this in any of above mentioned guides, so what will be the procedure here ?

Help will be appriciable here.


Hello @ArjunSalariya

Could you please elaborate on your end-goals?

You may not need the NetworkManager. There are many cases where you only need to use code for your interface of interest (wi-fi, ble, ethernet). Do you want to be able use LTE alongside the demo, or are you seeking to use LTE as your only means to connect to the internet?

There are some options for getting more information that is not provided in the user/programming guide. There’s doxygen documentation for the current release which provides high-level information about vDevModeKeyProvisioning. These doxygen docs can also be generated for your version of the source code by following this tutorial

You can usually find the same, or more, information by checking out the function declaration (usually in a *.h). There’s typically a high-level description of the function adjacent to its declaration. For example, here’s a descriptive code comment for vDevModeKeyProvisioning

Either of the above methods will inform that vDevModeKeyProvisioning is used to import the client credentials from the aws_clientcredential_keys.h and store them into non-volatile memory – assuming the board has NVM. For all the details, it’s usually best to see the code implementation.

1 Like

Thank you for an answer.

Yes LTE-M will be only connectivity provider in my case. no other interfaces are there.

Now in that case how to write DEMO_RUNNER() task ?
Here, if i call DEMO_RUNNER from task it internally going to use network manager which further can be configured only for Ethernet,Wi-Fi or BLE , so any suggestions ?

My end goal is to have a connectivity with aws cloud on device having AWS freertos with LTE-M and will send temperature data over MQTT initially.


If you are going to have just one connectivity (LTE), you do not need Network Manager.

The call flow for demos is like this:

For your case, you can the update the MQTT demo as per your needs and invoke the same form the demo runner task.

Hope that helps.


@ArjunSalariya , want to explicitly mention (what Gaurav has stated in his recommendation) that you can replace the calls to the Network Manager in the iot_demo_freertos.c file with calls to your LTE stack for connectivity. Thus, you don’t need to update the network manager implementation to support LTE-M.

The following sample project shows how to remove Network Manager:
FreeRTOS.gz (2.3 MB)

The function enableWiFi in the demos\demo_runner\iot_demo_freertos.c would probably be replaced with something like enableLTE.

Hope that helps.


PS - Please rename the download from FreeRTOS.gz to FreeRTOS.7z and decompress using 7-Zip.

Hi, Gaurav and Archit,

Thank you for the help really appriciated, i will go through this once and will share the updates.


As per @aggarg shared zip , I am able to implement network manager replacement for MQTT demo and i am able to communicate hello word with AWS.

But when i went to integrate OTA (CONFIG_OTA_UPDATE_DEMO_ENABLED) ,From _establishMqttConnection and IotMqtt_Connect it goes into pNewMqttConnection->pNetworkInterface->setReceiveCallback() it creates new recv() thread and it works but doesn’t come out and hence i am not able to achieve OTA_AgentInit() call and hence no further processing.

so is there anything missing here in my configuration .

My macros are configured with OTA_OVER_MQTT.

Any Advice would be greatly appreciable.

You do not need to establish a separate MQTT connection for OTA - use the same one in MQTT demo. You will need to do some re-factoring to share the same connection. At this line you should use the connection already established in MQTT demo:


Thanks for the help I am able to perform the OTA now ,
But have some issue so will open a new thread.
We can close this thread and mark as resolved.