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

ERROR: NRF_ERROR_FORBIDDEN

Hi all,

I am trying to do bonded buttonless DFU but an error named NRF_ERROR_FORBIDDEN was raised in enter_bootloader() function under ble_dfu_bonded.c.

The description is "The bootloader has write protected its settings page. This prohibits setting the peer data.  The bootloader must be compiled with NRF_BL_SETTINGS_PAGE_PROTECT=0 to allow setting the peer data."

On the other side, I have added NRF_BL_SETTINGS_PAGE_PROTECT=0 in project properties->Code->Preprocessor->Preprocessor Definations. Is this the right way to cancel the protection? 

I'm using NRF52840 and SDK17.

Thanks a lot,

RJ

Parents
  • Hi RJ,

    Unfortunately the error string NRF_BL_SETTINGS_PAGE_PROTECT is outdated, and that was only used in SDK 15.0.0. The mechanism in SDK 17 is like this (snippet from components\libraries\bootloader\nrf_bootloader_app_start_final.c):

        area_size = BOOTLOADER_SIZE + NRF_MBR_PARAMS_PAGE_SIZE;
        if (!NRF_BL_DFU_ALLOW_UPDATE_FROM_APP && !NRF_BL_DFU_ENTER_METHOD_BUTTONLESS && !NRF_DFU_TRANSPORT_BLE)
        {
            area_size += BOOTLOADER_SETTINGS_PAGE_SIZE;
        }
    
        ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, area_size);

    As you can see form the above, you can prevent write protection of the bootloader settings page by modifying sdk_config.h and set one of NRF_BL_DFU_ALLOW_UPDATE_FROM_APP, NRF_BL_DFU_ENTER_METHOD_BUTTONLESS or NRF_DFU_TRANSPORT_BLE to 1. In your case NRF_BL_DFU_ENTER_METHOD_BUTTONLESS should at least be set to 1.

    Einar

Reply
  • Hi RJ,

    Unfortunately the error string NRF_BL_SETTINGS_PAGE_PROTECT is outdated, and that was only used in SDK 15.0.0. The mechanism in SDK 17 is like this (snippet from components\libraries\bootloader\nrf_bootloader_app_start_final.c):

        area_size = BOOTLOADER_SIZE + NRF_MBR_PARAMS_PAGE_SIZE;
        if (!NRF_BL_DFU_ALLOW_UPDATE_FROM_APP && !NRF_BL_DFU_ENTER_METHOD_BUTTONLESS && !NRF_DFU_TRANSPORT_BLE)
        {
            area_size += BOOTLOADER_SETTINGS_PAGE_SIZE;
        }
    
        ret_val = nrf_bootloader_flash_protect(BOOTLOADER_START_ADDR, area_size);

    As you can see form the above, you can prevent write protection of the bootloader settings page by modifying sdk_config.h and set one of NRF_BL_DFU_ALLOW_UPDATE_FROM_APP, NRF_BL_DFU_ENTER_METHOD_BUTTONLESS or NRF_DFU_TRANSPORT_BLE to 1. In your case NRF_BL_DFU_ENTER_METHOD_BUTTONLESS should at least be set to 1.

    Einar

Children
No Data
Related