New firmware with Zephyr and old bootloader

HI,

two years ago I started my adventure with the nRF52840 microcontroller. I started using SEGGER Embedded Studio for ARM as my development IDE. I created a peripheral BLE device and am able to update the firmware via bluetooth following the pca10056_s140_ble_debug example of the SDK.

Now I want to use Zephyr OS.

My question is: can I still use the bootloader I used previously?

If not, how can I update my device with the new firmware developed with the Zephyr?

Thank you.

  • Hi Sigurd Hellesvik,

    Thanks for the reply.

    I don't understand what I need to check.

    Can you explain it better? I'm new to Zephyr.

    Thank you.

  • I want to see if this image looks the same for NCS and nRF5 apps.

    Sigurd Hellesvik said:
    Do you get any logs at all?

    Specifically UART logs from the application

    Stefano1984 said:
    Can you explain it better? I'm new to Zephyr.

    In case you have not seen it yet, I highly recommend https://academy.nordicsemi.com/ to learn.

  • Thanks for the suggestion.
    Actually if I start the firmware in debug I get an error when I execute the following line of code (I think):


    err = bt_enable(NULL);

    The error is as follows:

    [00:00:00.474,182] <inf> fs_nvs: No GC Done marker found: restarting gc
    [00:00:00.474,945] <err> os: ***** BUS FAULT *****
    [00:00:00.475,280] <err> os:   Imprecise data bus error
    [00:00:00.475,646] <err> os: r0/a1:  0x00000000  r1/a2:  0x00000000  r2/a3:  0x00000040
    [00:00:00.476,135] <err> os: r3/a4:  0x00000000 r12/ip:  0x00000000 r14/lr:  0x0006e9cf
    [00:00:00.476,623] <err> os:  xpsr:  0x41000000
    [00:00:00.476,959] <err> os: Faulting instruction address (r15/pc): 0x0004b760
    [00:00:00.477,416] <err> os: >>> ZEPHYR FATAL ERROR 26: Unknown error on CPU 0
    [00:00:00.477,874] <err> os: Current thread: 0x20003ab8 (idle)
    [00:00:00.483,184] <err> fatal_error: Resetting system

    This below is the image of the flash with only the bootloader:

    Below is the image of the flash with the bootloader and the nRF5 application:

    Finally, below is the image of the flash with the bootloader and the Zephyr application:

  • Stefano1984 said:
    The error is as follows:

    It is very good to know that we get logs! It does mean that we are indeed able to run the new app.
    So, that means we know that load offset is correct.

    In that case, we need to debug the application itself.

    Just to sanity-check: The application works with only zephyr (No bootloader), correct?

     The bus fault happens in the idle thread (Current thread: 0x20003ab8 (idle)).
    Try increasing CONFIG_IDLE_STACK_SIZE.

    Stefano1984 said:
    err = bt_enable(NULL);

    Then try to DFU to an application without BLE first. For example hello_world. Seeing if such an app works would give valuable information.

    If such an app works, try to update into one of our BLE examples, unchanged aside from flash load offset. Then see if those work.

  • Hi.

    Thanks for the suggestion.

    I have some news.
    I found that if I enter the statement CONFIG_FLASH_LOAD_OFFSET=0x27000 without bootloader it doesn't work. No reply. Not even if I start debugging.

    The only thing I can tell you is that on the debug terminal I read the following lines:

    JLinkGDBServerCL: SEGGER J-Link GDB Server V7.94e Command Line Version
    JLinkGDBServerCL: 
    JLinkGDBServerCL: JLinkARM.dll V7.94e (DLL compiled Jan 15 2024 15:18:46)
    JLinkGDBServerCL: 
    JLinkGDBServerCL: -----GDB Server start settings-----
    JLinkGDBServerCL: GDBInit file:                  none
    JLinkGDBServerCL: GDB Server Listening port:     55862
    JLinkGDBServerCL: SWO raw output listening port: 2332
    JLinkGDBServerCL: Terminal I/O port:             2333
    JLinkGDBServerCL: Accept remote connection:      localhost only
    JLinkGDBServerCL: Generate logfile:              off
    JLinkGDBServerCL: Verify download:               off
    JLinkGDBServerCL: Init regs on start:            off
    JLinkGDBServerCL: Silent mode:                   on
    JLinkGDBServerCL: Single run mode:               on
    JLinkGDBServerCL: Target connection timeout:     0 ms
    JLinkGDBServerCL: ------J-Link related settings------
    JLinkGDBServerCL: J-Link Host interface:         USB
    JLinkGDBServerCL: J-Link script:                 none
    JLinkGDBServerCL: J-Link settings file:          none
    JLinkGDBServerCL: ------Target related settings------
    JLinkGDBServerCL: Target device:                 nrf52840_xxaa
    JLinkGDBServerCL: Target device parameters:      none
    JLinkGDBServerCL: Target interface:              SWD
    JLinkGDBServerCL: Target interface speed:        12000kHz
    JLinkGDBServerCL: Target endian:                 little
    JLinkGDBServerCL: 
    =thread-group-added,id="i1"
    =cmd-param-changed,param="pagination",value="off"
    0xfffffffe in ?? ()
    [New Remote target]
    [New Thread 536886128]
    [New Thread 536885944]
    [New Thread 536885728]
    [New Thread 536886312]
    [New Thread 536881984]
    [New Thread 536881440]
    [New Thread 536882200]
    [New Thread 536882384]
    [New Thread 536885544]
    
    Thread 2 received signal SIGTRAP, Trace/breakpoint trap.
    0xfffffffe in ?? ()
    Execute debugger commands using "-exec <command>" or "`<command>", for example "-exec info registers" or "`info registers" will list registers in use (when GDB is the debugger)

    At this point I created another project that only prints Hello Word.

    With the instruction CONFIG_FLASH_LOAD_OFFSET=0x27000 without bootloader it doesn't work.

    However with the instruction CONFIG_FLASH_LOAD_OFFSET=0x27000 with bootloader IT WORKS.

    What could my problem be?

Related