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

nRF52 Bootloader acting differently on different boards

Hi All,

I have developed an application on the RedBear BLE Nano2, and am trying to port it accross to a custom nRF52 board.

The Hex that the Arduino IDE outputs does not contain the soft device, so I have run MergeHex to combine the SoftDevice/Bootloader that the application hex is intended to work with.

The bootloader is: SoftdeviceS132_2.0_SDK11_Bootloader_20161221.hex

The merge works correctly, and if I drag and drop the resultant hex file over the DapLink to the BLE Nano, everything works.

When I use the DapLink to program the custom board, nothing seems to run.

I also tried putting the same hex file on an nRF52K, and this ends up getting locked in the bootloader mode.Constantly advertising dfuTarg.

I have written a lot of code using the RedBear Libraries, which is happily working on the BLE Nano2, and I would love to get this working on my custom board. Any advice about why the bootloader/softdevice may be going screwy would be appreciated, or advice on how to merge my application hex with a different SoftDevice file would also be helpful.

Pleae can someone explain the cause of the different behaviours I am seeing, and how I overcome it?

Cheers.

Parents
  • Hi Steve,

    Does your custom board have an external 32kHz crystal on it? If not, then you will have to set the Low Frequency Clock Source to use the internal RC oscillator. It looks like the BLE Nano2 has it and I know that the nRF52 DK has it, so that might be the reason why your code is not running on the custom board.

    If you want to flash a combined SoftDevice, Bootloader and Application hex file created with mergehex, where the device jumps to the application without having to perform a OTA update, you have to set the BANK_VALID_APP flag in bootloader_settings.c, i.e. change the line

    uint8_t  m_boot_settings[CODE_PAGE_SIZE]    __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used));   
    

    to the following

    uint8_t  m_boot_settings[CODE_PAGE_SIZE]    __attribute__((at(BOOTLOADER_SETTINGS_ADDRESS))) __attribute__((used)) = {BANK_VALID_APP};
    

    Alternatively you can merge the bootloader hex with this hex file to set the BANK_VALID_APP flag.

  • Thanks Bjorn,

    The custom board does not have a 32KHz crystal. Is it possible for me to use the Arduino IDE that is used with the BLE Nano in order to set the board to use the internal RC?

    I guess it needs to be set in the bootloader, or can I set this in my application?

    Regarding merging hex files, the only bootloader than I have been able to successfully merge with my application Hex that the Arduino IDE produces is the 'SoftdeviceS132_2.0_SDK11_Bootloader_20161221.hex' As I believe the address locations that are set in the Hex files need to match up.

    I also don't fully understand why on the nRF52DK the bootloader gets stuck in OTA advertising mode, and does not run the application. Is there a trigger that causes this?

    Cheers

Reply
  • Thanks Bjorn,

    The custom board does not have a 32KHz crystal. Is it possible for me to use the Arduino IDE that is used with the BLE Nano in order to set the board to use the internal RC?

    I guess it needs to be set in the bootloader, or can I set this in my application?

    Regarding merging hex files, the only bootloader than I have been able to successfully merge with my application Hex that the Arduino IDE produces is the 'SoftdeviceS132_2.0_SDK11_Bootloader_20161221.hex' As I believe the address locations that are set in the Hex files need to match up.

    I also don't fully understand why on the nRF52DK the bootloader gets stuck in OTA advertising mode, and does not run the application. Is there a trigger that causes this?

    Cheers

Children
No Data
Related