Arm Mbed OS support forum

NUCLEO-F411RE and Mbed Bootloader in Pelion

Hello colleagues!

I move step by step into the world of Mbed OS.
I mastered esp8266 support and decided to move on to more complex things, for which I decided to master Mbed - remote firmware download (FOTA, IAP).

I downloaded and compiled the projects mbed-os-example-pelion-5 and mbed-os-example-pelion under Mbed OS versions 5.xx and 6.xx.
When I download the program to the NUCLEO-F411RE board, I see only one message in the serial terminal window: Mbed Bootloader.
From my point of view, Bootloader does not transfer control to the main program. Perhaps Bootloader is waiting for some kind of external influence (command, button)?

I tried to compile the project under Mbed IDE and Keil Studio - the result is the same.
I can’t compile the project under Keil uVision5, more than 100 errors.

Someone successfully made a project with Mbed Bootloader in Pelion for NUCLEO-F411RE or any NUCLEO board and what could be the reason?
I know there is a separate forum for Pelion, but Pelion doesn’t seem to have anything to do with it yet!

Why is …/mbed-os-example-pelion-5.NUCLEO_F411RE_header.hex file and not * .bin file? .

Here’s a post from Keil Studio:
Using ROM regions bootloader, header, application in this build.
Region bootloader: size 0x8000, offset 0x8000000
Region header: size 0x70, offset 0x8008000
Region application: size 0x77c00, offset 0x8008400
link mbed-os-example-pelion-5.NUCLEO_F411RE
L3912W: Option ‘legacyalign’ is deprecated.
elf2bin mbed-os-example-pelion-5.NUCLEO_F411RE
Merging regions
Filling region bootloader with /tmp/chroots/ch-cc4ac89c-cbf1-48d5-852a-daecd5f7cc5f/src/bootloader/mbed-bootloader-nucleo_f411re-block_device-kvstore-v4.1.0.bin
Filling region header with /tmp/chroots/ch-cc4ac89c-cbf1-48d5-852a-daecd5f7cc5f/build/mbed-os-example-pelion-5.NUCLEO_F411RE_header.hex
Filling region application with /tmp/chroots/ch-cc4ac89c-cbf1-48d5-852a-daecd5f7cc5f/build/mbed-os-example-pelion-5.NUCLEO_F411RE_application.bin
Space used after regions merged: 0x609e0
Merging regions
Filling region application with /tmp/chroots/ch-cc4ac89c-cbf1-48d5-852a-daecd5f7cc5f/build/mbed-os-example-pelion-5.NUCLEO_F411RE_application.bin
Space used after regions merged: 0x585e0
Build succeeded

BR, Vadim

Hi,

WRT target configuration, you need to connect external SD-card module for the F411RE board to store secure credentials.

Pin assignment is found here:

Hello,
English is not my native language, so do not pay attention if suddenly I do not quite correctly express my thoughts or emotions.
I’ll ask right away what is “WRT target configuration” or where to read about it?
I would agree about the SD card, but the post confused me:

I would be glad to see similar messages, especially since I see them in the bootloader *.bin file:
“Mbed Bootloader
booting …
Failed to jump to application!
@ t [DBG] Active firmware slot is empty
[DBG] Failed to boot active application
[DBG] Active firmware integrity check failed
[DBG] Update active firmware
Update image too large
Update image integrity check failed
Update image is older
No Update image
[DBG] New active firmware is valid
[DBG] Firmware update failed
[DBG] Active firmware up-to-date
[ERR] Active firmware invalid”

But I only see “Mbed Bootloader” in the serial port monitor window … :frowning:

I added these lines for SPI2, I think which pins and which interface to use is not important? I checked the work with esp8266 over two wires on a separate example, everything works fine.
{

“sd.SPI_MOSI”: “PB_15”,
“sd.SPI_MISO”: “PB_14”,
“sd.SPI_CLK”: “PB_13”,
“sd.SPI_CS”: “PB_12”,
“esp8266.tx”: “PA_9”,
“esp8266.rx”: “PA_10”,
“esp8266.provide-default”: true
},
I connected such a module and an 8 GB SD card, I could not find less: Adding ethernet connectivity to a STM32-Nucleo /
it looks like some kind of hardware problem
The module itself is functional, the example on this link works with the network.
And I remember that the signals for select SPI for SD and Ethernet are different on different pins.

I haven’t been able to get the map to work yet using this example:

if compiled with
#include “HeapBlockDevice.h”
BlockDevice * bd = new HeapBlockDevice (4096, 1, 1, 512);
then the example works fine on the heap.
I’ll try to figure out where the problem is with the SD card, but it will be very disappointing if the problem is not in its absence … :slight_smile:

I read the firmware with the programmer and I see three blocks there at the addresses that are specified in the configuration file.
To be honest, I have no idea what I’m doing wrong.
Maybe try to buy NUCLEO-F737ZI with Internal Flash, but it’s not very fast.
Perhaps the matter is in Build-only and the example is not working?
ST NUCLEO_F411RE Wi-Fi ESP8266 SD card Build-only

As I expected, the problem was in hardware.
There was not enough pull-up on the SS signal for the second device on the SPI.
For verification, I used this version of the program:

As I assumed, the SD card now work, but Pelion did not.
What else could be the problem? What do the experts think?

Hello,
I thought about your post again.
The specified pin assignment for the SPI is the only possible one, is it specified inside the * .bin bootloader file and cannot be changed?
“sd.SPI_MOSI” : “PC_3”,
“sd.SPI_MISO” : “PC_2”,
“sd.SPI_CLK” : “PC_7”,
“sd.SPI_CS” : “PB_9”,
Or can other pins and any SPI port be used, if I correctly set their pin assignment in mbed_app.json?
Is the algorithm of the bootloader mbed-bootloader-nucleo_f411re-block_device-kvstore-v4.1.0.bin and the like described anywhere?

Perhaps a stupid question, but is it possible to connect a small HeapBlockDevice of 4 … 16 kb in RAM during debugging in order to completely exclude the influence of external equipment (SD, etc.)? As soon as I manage to revive Pelion in the complex, I can think further, going step by step.

I would be grateful for any information if it helps to get off the ground.

BR, Vadim

Hi Vadim,

I have tested the mbed-os-example-pelion example with default setting and worked fine.

Boot log is below:

Mbed Bootloader
No Update image
[DBG ] Active firmware up-to-date
booting...

Application ready
Connect to network
Network initialized, connected with IP 172.16.80.xxx

Start developer flow
Create resources
Register Pelion Device Management Client

Counter 1
Counter 2
Counter 3
Client registered.
Account ID: 0xxxxxxxxxx8be206ae5ecf600000000
Endpoint name: 0xxxxxxxxxxea2dceaa1bd0d00000000
Device ID: 0xxxxxxxxxxea2dceaa1bd0d00000000

Counter 4
Counter 5
Counter 6
Counter 7

I have changed the mbed_app.json file in the example.

  • Changed nsapi.default-wifi-ssid and nsapi.default-wifi-password

  • Removed esp8266.rts and esp8266.cts as my ESP8266 module doesn’t support hardware flow control

The specified pin assignment for the SPI is the only possible one, is it specified inside the * .bin bootloader file and cannot be changed?

You can use different pin assignment for the SPI, but you also need to rebuild bootloader with same pin assignment.

The bootloader code is here: GitHub - PelionIoT/mbed-bootloader: Generic bootloader to be used in conjunction with Pelion Device Management Client

And app_config file for the F411RE is here: mbed-bootloader/internal_kvstore_with_sd.json at master · PelionIoT/mbed-bootloader · GitHub

To do this:

  • Modify the configs/internal_kvstore_with_sd.json file for your specific pin assignment
  • Build the bootloader, e.g. mbed compile -m nucleo_f411re -t gcc_arm --app-config configs/internal_kvstore_with_sd.json --profile release (you may need to change from STDIO_UART_TX to CONSOLE_TX in bootloader_common.cpp, if you got compile error)
  • Copy mbed-bootloader.bin file to mbed-bootloader-nucleo_f411re-block_device-kvstore-v4.1.0.bin in the mbed-os-example-pelion
  • Then, change pin assignment of the mbed_app.json of mbed-os-example-pelion as same as mbed-bootloader and build mbed-os-example-pelion example

I hope this helps.

Toyo

Hello, Toyomasa Watarai

Thanks for your support!

After a number of unsuccessful experiments, I still bought NUCLEO-F767ZI and ran the Pelion example on it.
At least that way I’ll understand how it all should work correctly. Then I will repeat on F411RE with a SD card.
I see similar messages in the terminal and see my device on Pelion Device Management.
I decided to try updating the software, for which, in fact, it was started.
I uploaded a .bin image but I don’t understand where can I get the Manifest?
I am using Windows 10 and Keil online/Mbed Compiler online. The command line is a different civilization for me.
And the second, less important question: is it possible to give the device a more readable name than 017e58d31c07d66e8889b73…?
The same question applies to other fields of the view:
Vendor ID 6465765f6d616e756661…
Class ID 6465765f6d6f64656c5f6e…

If there is a specialized forum for Pelion on another resource or FAQ, please tell me.

Hi,

I decided to try updating the software, for which, in fact, it was started.
I uploaded a .bin image but I don’t understand where can I get the Manifest?

You can find how to create manifest file Here:

This step is a bit complicated. If you are using Mbed online IDE, the manifest file can be generated automatically for you (Note that Keil Studio Cloud does not support Pelion Device Management integration).

  1. Open Mbed Online IDE
  2. Import mbed-os-example-pelion example from GitHub
  3. From [Pelion Device Management] menu…
    3-1. Manage Connect Certificates
    3-2. Apply Update Certificate
  4. Build the example and download .bin file to target board, make sure your board connected to Pelion DM service from portal
  5. Modify the program for update (e.g. adding new message by printf)
  6. From [Pelion Device Management] menu, select Publish Firmware Update. This will eventually navigate to portal site
  7. In portal site, create update campaign, select your device ID and finish
  8. From Update campaign menu, select the campaign and start

And the second, less important question: is it possible to give the device a more readable name than 017e58d31c07d66e8889b73…?

  • From Pelion DM portal, select device directory and click your device
  • Edit (pencil icon on top right) and change the name

Thanks,
Toyo