This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Blinky Application Not Executing in IAR when Secure DFU Bootloader is Present

Hi,

I am using an nrf52840 MCU, Nordic SDK 16.0.0 and IAR Workbench for ARM v8.40.1.

The MCU has the following configuration:

- MBR installed

- DFU secure bootloader (USB only) installed and functional

- Bootloader settings installed

For the main application, I'm trying to use the example blinky application. The main application is downloaded via the Segger interface using IAR.

Using the above setup, my issue is that the blinky application does not execute at all - even after a power cycle.

If I erase the secure bootloader and its settings, leaving only the MBR, the blinky application then executes correctly, e.g.:

1. Erase the entire flash

nrfjprog.exe --family NRF52 --eraseall

Output:

Erasing user available code and UICR flash areas.
Applying system reset.

2. Program the MBR

nrfjprog --reset --program mbr.hex  --family NRF52 --sectoranduicrerase

Output:

Parsing hex file.
Erasing page at address 0x0.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
Applying system reset.
Run.

3. Program Blinky App

nrfjprog --reset --program blinky_pca10056_mbr.hex --family NRF52 --sectoranduicrerase

Output:

Parsing hex file.
Erasing page at address 0x1000.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
Applying system reset.
Run.

The ROM settings for the blinky example is: 0x1000 - 0xfffff

The RAM settings for the blinky example is: 0x20000008 - 0x2003ffff

Any ideas what I'm missing?

Thanks to all in advance.

Parents
  • Hi Chibi, 

    Could you please also post how you generate the bootloader setting ? 

    If the bootloader setting is not generated and flashed properly, the bootloader won't jump to the application. 

    When you said you programmed the blinky example and it didn't work when the bootloader is flashed, how did you program the blinky example ? 
    Did you do DFU to flash the blinky example or you flash it directly ? 


    You can enable logging inside the bootloader to have more information. 

  • Hi Hung Bui,

    Bootloader Settings Generation:

    nrfutil.exe settings generate --family NRF52 --application blinky_pca10056_mbr.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex

    Output:

    Note: Generating a DFU settings page with backup page included.
    This is only required for bootloaders from nRF5 SDK 15.1 and newer.
    If you want to skip backup page generation, use --no-backup option.

    Generated Bootloader DFU settings .hex file and stored it in: settings.hex

    Bootloader DFU Settings:
    * File:                     settings.hex
    * Family:                   nRF52
    * Start Address:            0x0007F000
    * CRC:                      0x836566AC
    * Settings Version:         0x00000001 (1)
    * App Version:              0x00000001 (1)
    * Bootloader Version:       0x00000001 (1)
    * Bank Layout:              0x00000000
    * Current Bank:             0x00000000
    * Application Size:         0x00000618 (1560 bytes)
    * Application CRC:          0x055A1126
    * Bank0 Bank Code:          0x00000001
    * Softdevice Size:          0x00000000 (0 bytes)
    * Boot Validation CRC:      0x00000000
    * SD Boot Validation Type:  0x00000000 (0)
    * App Boot Validation Type: 0x00000000 (0)

    Program the Bootloader Settings:

    nrfjprog --program settings.hex -f NRF52 -r

    Output:

    Parsing hex file.
    Reading flash area to program to guarantee it is erased.
    Checking that the area to write is not protected.
    Programming device.
    Applying system reset.
    Run.

    To program the blinky example, I initially tried just IAR but I've also tried via the command line, as per my original post.

    I'm not using DFU quite yet - I just wanted to get a basic setup working first before creating the encrypted DFU packages.

    I'll try to enable the logging to see if I can extract more information.

  • Thanks for your time and clear explanations. It has been very helpful and I'm starting to understand what is going on.

    One final question, if I may:

    1. I tried to use the _debug version of the secure DFU bootloader but I didn't see any output on the JLink RTT Viewer or the JLink RTT client. Any ideas how to get the logging to appear?
  • Please check sdk_config.h file to see if NRF_LOG_ENABLED = 1 ? 

    Also make sure you erase the chip before testing with the debug bootloader as the address of the debug bootloader is different from the normal one. The chip need to be erased if you want to change bootloader address. 

  • Sorry for the late reply.

    I checked the sdk_config.h file and NRF_LOG_ENABLED was already set to 1. The NRF_LOG_BACKEND_RTT_ENABLED setting was also set to 1.

    I didn't erase the whole chip before so I'll give that a go and report back on my findings.

    Thanks again.

  • Hi Hung Bui,

    Just a short follow-up to say that I could not get the NRF log output to be displayed (even after erasing the whole chip) in the JLink RTT Viewer / Client. However, I did manage to get the log output redirected to the USB CDC virtual COM port instead and that works perfectly.

    Is there something I need to do to mark this case as to be closed / answered?

    Thanks again for all your help and assistance.

  • Hi Chibi, 

    I'm glad that you found a workaround. Please just leave this case like this. You can come back or open a new case if there is a new question. 

Reply Children
Related