Mbed forum

Update mbed device via NB IoT UDP

mbed_cloud

(Sy Hoang Mai) #1

Hi, I want to develop a prototype with ublox c030-n211 board to communicate with Pelion cloud via NB-IoT. Can I update the firmware of stm32 on board when the modem only support UDP?


(shai feldman) #2

Hi ,
Thank you for your question .
I checked our documentation and it looks like the answer to your question is - yes .
Please see attached link : https://cloud.mbed.com/docs/current/introduction/management-services-and-protocols.html
I hope it will answer your question.

Thank You ,
IOTSUPPORT


(Sy Hoang Mai) #3

Thank you for your reply. Could you please point me to the section I should read in the documentation to clarify this.

From my understanding Pelion cloud triggers the update procedure for the MCU, then the MCU need to download a manifest file (probably hosted on a webserver). The MCU then parse the manifest then parse it, do checking such as version, etc… then proceed to download the firmware from an URI uploaded on AWS (http link). The MCU then download that new firmware then proceed to its local update procedure. Please correct me if I misunderstand something here. My guess is http download is not supposed to be via UDP.

Previously I have tried to use nucleo-767zi and BG96 to connect to Pelion. The connection to Pelion works fine with UDP (TCP is not yet supported in mbed for BG96), but it always fail update immediately with this error
([SMCC] Error occurred : MbedCloudClient::UpdateWarningURINotFound)


(Sami Lappalainen) #4

Hi,

Have you checked https://cloud.mbed.com/docs/current/connecting/mbed-os.html documentation related device updated?

Could it be possible if you execute steps defined in this tutorial to validate device update functionality?

Regards,
Sami L
Arm Pelion Device Management support


(Sy Hoang Mai) #5

Previously I can update the program via Ethernet with this example from ST (so I assumed I followed these steps correctly), then I replace the NetworkInterface with EasyCellularConnection
strong text
Added to macro list in mbed_app.json

“CELLULAR_DEVICE=QUECTEL_BG96”, “MDMTXD=D1”,“MDMRXD=D0”

Modify in main()

EasyCellularConnection* cellularNet = new EasyCellularConnection(false);
net = (NetworkInterface*) cellularNet;
nsapi_error_t status = cellularNet->connect(“0000”, “internet”, “”, “”)

Modify in mbed_cloud_client_user_config.h since BG96 doesnt support TCP (until this mbed released few days ago, but I havent tried again)

//#define MBED_CLOUD_CLIENT_TRANSPORT_MODE_TCP
#define MBED_CLOUD_CLIENT_TRANSPORT_MODE_UDP

I view the manifest file (e.g. this file)generated by online IDE there is a link to my new firmware pointing to an HTTP site. So I assume this cause problem to the firmware update (or I already failed at downloading the manifest file).

With these modifications, I can connect to Pelion via BG96(2G, UDP only), but can’t update the firmware. I will try again with a ublox modem which only supports UDP (n211), but just ask in advance to save me time later.

Btw, I noticed a DNS resolve problem when running the original example from ST (mentioned at the beginning). The log output looks like this. I used Wireshark and see there’s DNS query as well as response, but somehow the MCU ignores that.

[SMCC] Error occurred : MbedCloudClient::ConnectDnsResolvingFailed
[SMCC] Error code : 12
[SMCC] Error details : Client in reconnection mode DnsResolvingFailed

Could you also help me get rid of the **[This question is awaiting moderation]** when I post question in the mbed forum if you are a person from Arm?

Thank you!


#6

Once you have the manifest, you should be able to upload to Pelion and push updates. Let us know how it goes with this device


(Marcus Chang) #7

The example you are using is using version 1.4 of the Pelion Device Management client. Firmware updates over CoAP (as opposed to HTTP) was introduced in version 1.5 and made default in version 2.0.


(Sy Hoang Mai) #8

@marcuschang Thank you very much! That is a great news for me, and also answer my question.


(Sy Hoang Mai) #9

Today I tried to switch simple-mbed-cloud-client to newer version (mbed os at 5.10.4), but I cannot initialize sd card.

[ERR ][PAL ]: Failed to create folder, was the storage properly initialized?
[ERR ][esfs]: esfs_init() 0
[ERR ][esfs]: esfs_init() - pal_fsMkDir() for working directory failed with pal_status = 0xfc000008
[ERR ][esfs]: esfs_reset() - esfs_init() failed
[ERR ][fcc ]: storage.c:104:storage_reset:<=== Failed reset ESFS (esfs_status 4)
[ERR ][fcc ]: factory_configurator_client.c:143:fcc_storage_delete:<=== Failed in storage_reset. got ESFS error
[WARN][SMCC]: Failed to delete FCC storage (again) (16)
Pelion Client initialization failed (16)

If I revert back to rev a885642(release 1.4.1) or a bit earlier then sd card is formatted and can be initialize.
Could you point me to the revision that can initialize sd card and update via coap?


(shai feldman) #10

Please find below link :
https://os.mbed.com/releases/


(Sy Hoang Mai) #11

I got this issue when change revisions of simple-mbed-cloud-client while keeping mbed-os at a fixed released (5.10.4).
Which revision (hash) of simple-mbed-cloud-client I should use?
Do you think my issue is coming from mbed-os or simple-mbed-cloud-client. If it is mbed-os, which mbed 5.10 release should use?