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

NRF_ERROR_NO_MEM during DFU over UART (There is no softdevice in use just MBR , Bootloader and Application)

Hello,

I have  nRF52840 with code that is based on SDK16.

I am not using Softdevice in my project - just  MBR , Bootloader and Application.

I was able to upgrade my code over UART while using bootloader code (based on SDK 16 example secure_bootloader_uart_mbr_pca10056) and had no issues - everything worked fine.

Yesterday, after I have added to my application FDS capabilities I found out that the UART DFU fails with error 0x04 (NRF_ERROR_NO_MEM).

Any ideas on how to fix it ?

These are the linker section placement MACROs:

FLASH_PH_START=0x0

FLASH_PH_SIZE=0x100000

RAM_PH_START=0x20000000

RAM_PH_SIZE=0x40000

FLASH_START=0x1000

FLASH_SIZE=0xdf000

RAM_START=0x20000008

RAM_SIZE=0x3fff8

  • Hello,

    Is it possible that you may have run out of free flash (Memory layout)? What's the size of the application image (size of *.bin file in DFU zip), and how many flash pages did you allocate to FDS? Also, where did you get the NRF_ERROR_NO_MEM error from?

    Please include the debug log from the bootloader if you have it.

  • Hello Vidar and thanks for the quick reply.

    The size of the application when the DFU process went well was 80.4 KB

    The size of the application now (with FDS support) when the DFU process fails is 95.2 KB

    The bootloader location in my setup is 0x00080000  :

    should I change the bootloader  to 0x0002 8000?

    The applications are at 0x00000FF8

    and 0x00016000:

    Debug log:

    <info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_settings: Using settings page.
    <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Enter nrf_bootloader_fw_activate
    <info> app: No firmware to activate.
    <debug> app: App is valid
    <debug> app: DFU mode requested via GPREGRET.
    <info> nrf_bootloader_wdt: WDT is not enabled
    <debug> app: in weak nrf_dfu_init_user
    <debug> app: timer_stop (0x20000024)
    <debug> app: timer_activate (0x20000024)
    <info> app: Entering DFU mode.
    <debug> app: Initializing transports (found: 1)
    <debug> nrf_dfu_serial_uart: serial_dfu_transport_init()
    <debug> nrf_dfu_serial_uart: serial_dfu_transport_init() completed
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> nrf_dfu_validation: PB: Init packet data len: 63
    <debug> app: Enter main loop
    <error> app: Received an error: 0x00000004!
    <info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> app: App is valid
    <warning> nrf_dfu_settings: No additional data erased
    <info> nrf_dfu_settings: Backing up settings page to address 0xFE000.
    <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    <debug> app: Running nrf_bootloader_app_start with address: 0x00001000
    <debug> app: Disabling interrupts. NVIC->ICER[0]: 0x0

    Thanks in advance ,

    Rafalino

  • I have changed the bootloader address to 0x000F2000

    These are the linker section placement MACROs of the Bootlaoder code (secure_bootloader_uart_mbr_pca10056):

    FLASH_PH_START=0x0

    FLASH_PH_SIZE=0x100000

    RAM_PH_START=0x20000000

    RAM_PH_SIZE=0x40000

    FLASH_START=0x000F2000

    FLASH_SIZE=0x0000B000

    RAM_START=0x20000008

    RAM_SIZE=0x3fff8

    These are the linker section placement MACROs of the Application code (without SD):

    FLASH_PH_START=0x0

    FLASH_PH_SIZE=0x100000

    RAM_PH_START=0x20000000

    RAM_PH_SIZE=0x40000

    FLASH_START=0x1000

    FLASH_SIZE=0xC8000

    RAM_START=0x20000008

    RAM_SIZE=0x3fff8

    But the issue still happens and I get:

     <error> app: Received an error: 0x00000004!

    I set FDS pages to 3 in my application sdk.config.h file  (FDS_VIRTUAL_PAGES 3)

    This is the memory map of the device when I see the issue:

    Application address 0x00000FF8 - 00018CB8 (97464 Bytes):

    Bootloader address 0x000F2000 - 0x000FC1B4 (41396 bytes):

    FDS page1 0x000F1000-0x000F1008 (8 bytes):

    FDS page2 0x000F0000-0x000F0008 (8 bytes):

    FDS page3  0x000EF000-0x000E008 (8 bytes):

  • The memory layout looks ok. Could try to place a breakpoint inside the NRF_DRV_UART_EVT_ERROR case in nrf_dfu_serial_uart.c::uart_event_handler() and app_error_handler_bare() in main.c  to see if  the program reaches either one or both of them? Also, have you tried to disable FDS again to verify that DFU still works? 

  • Hello Vidar,

    Since I need to deploy my project tomorrow , I have disabled the FDS code and decided to use UICR (User information configuration register) to store the few parameters that I needed to keep in a None Volatile Memory.  This worked well for me so I decided to ditch the FDS options.

    Thank you for your assistance.

    Rafalino. 

Related