Separate MCUboot .hex not working

Hi,

I have an application using MCUboot (Only for using with serial recovery. No SMP server running in app).

I enable CONFIG_BOOTLOADER_MCUBOOT and parent and child images are generated automatically.

As far as I know:

  • build/mcuboot/zephyr/zephyr.hex: only mcuboot

  • build/zephyr/zephyr.hex: only application

  • build/zephyr/merged.hex: mcuboot+application

  • build/zephyr/app_update.bin: signed bin for FW upgrade

When I flash just mcuboot and try to boot in serial recovery mode, there is no response to mcumgr image list or image upload commands (Error: NMP timeout).

If I flash merged.hex and try to boot in serial recovery before any app execution, the same problem occurs, there is no way to boot in serial recovery. Is only after booting to app at least 1 time after hex flashing, I can boot in serial recovery and list image or upload a new one.

Any clue why is this happening?

Another question is about build/zephyr/zephyr.hex (Only app). This hex has an offset so app will be flashed just after MCUboot, and if I flash just this file, app does not boot. 

Is there any option to generate also an hex for flashing just app without bootloader?

If I flash the 'just app' bin at zero offset, Will it always work?

Thanks in advance!

Pedro.

Parents Reply Children
  • My colleague created a serial recovery sample with instructions in the readme, could you test it out: https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/mcuboot_serial_recovery_uart

    Try changing CONFIG_BOOT_SERIAL_DETECT_PIN to 13, which should be connected to Button 1 on the nRF52 DK (I guess you're using the nRF52 DK).

    Then test the sample with NCS v1.9.0 and the nrf52832?

    Let me know if it still fails

    Best regards,

    Simon

  • Hi Simon,

    I tested your colleague example with the following results:

    Board .hex Result
    nRF52840-DK Just MCUBoot Serial recovery OK
    nRF52840-DK Merged Serial recovery OK
    Arduino Nicla Sense ME (nRF52832) Just MCUBoot Can't boot in serial recovery
    Arduino Nicla Sense ME (nRF52832) Merged Can't boot in serial recovery

    Exactly same example, only change is that I've used GPIO 11 for nRF52840-DK and GPIO 29 for Arduino Nicla Sense ME.

    I've tried with NCS v1.9.0 and NCS v2.0.0 with same results.

    With my app I can boot Nicla Sense ME board in serial recovery if at least one execution of app after flashing (As I explained in the first post), but with your colleague example even booting to app first and then trying to boot in serial recovery, it never works.

    About my other questions:

    Is there any option to generate also an hex for flashing just app without bootloader?

    If I flash the 'just app' bin at zero offset, Will it always work?

    Thank you again for your help.

    Regards,

    Pedro.

  • Do you have an external LF crystal on the Arduino Nicla ME board? If not try to enable the internal RC:  What is needed in NCS/Zephyr to make nRF52840 module (Fanstel BC840) to use RC instead of external crystal? 

    Best  regards,

    Simon

  • Arduino Nicla Sense ME has an external LF oscillator (See schematics), Anyway I tried enabling the internal RC but nothing changed. Still not working.

    I've used this config options:

    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=n
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_250PPM=y

    Do you have a board with nRF52832 and can try the example?

    Regards,

    Pedro.

  • I tested the sample with an nRF52 DK and it worked fine. I did the following:

    Set CONFIG_BOOT_SERIAL_DETECT_PIN to 13

    • Built and flashed the sample with NCS v1.9.0, and ran it. I saw that led2 was blinking, so it was working
    • Modified the sample to blink LED1 instead (dk_set_led_on(0)) and built it without flashing
    • Ran nrfjprog --com to see what com port to use and got the following output:
      • 682968457    COM17    VCOM0
    • Then I pressed button1 and reset the device
      • I did not see LED1 blinking, which means that it stopped in mcuboot and the app didn't run
    • Then I ran the following commands to perfom the DFU and reset the device
      •  mcumgr conn add acm0 type="serial" connstring="dev=COM17,baud=115200,mtu=512"
      • mcumgr -c acm0 image upload build/zephyr/app_update.bin
      • mcumgr -c acm0 reset
    • I could then see that the DFU was successful, since LED0 was blinking (new application is running)

    The dk_buttons_and_leds library (which is used the blink the LEDs) will look for led nodes which should be defined in the board folder for the nRF boards. I'm not sure if the Arduino Nicla Sense ME board has this. You could just use the GPIO API instead, like done in the Zephyr Blinky sample.

    Also, how does the Arduino board expose the UART? For the nRF52 DK we have an Interface MCU which works as a USB to UART Bridge (virtual COM port).

    Pedro said:
    With my app I can boot Nicla Sense ME board in serial recovery if at least one execution of app after flashing (As I explained in the first post), but with your colleague example even booting to app first and then trying to boot in serial recovery, it never works.

    Would you be able to debug with your app a little more? Does it go into boot_serial_start()-->while loop? Have you checked the lines using a logic analyzer, is there any activity going on there?

    Let me know if anything is unclear, or if you need help debugging.

    Best regards,

    Simon

Related