Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

BLE Bootloader Example not Advertising on BLE Nano

Hello,

i'm using the BLE Nano v2 with the nrf52832 on it and a DAPLink USB-Dongle. IDE is Eclipse with gcc and SDK v14.2. My current aim is to do an OTA DFU so I tried the bootloader_secure_ble example following these steps: devzone.nordicsemi.com/.../getting-started-with-nordics-secure-dfu-bootloader
I've customised the leds_init() & buttons_init() function to match my board, updated the dfu_public_key.c file and flashed it together with the s132 softdevice v4.0, my application and a settings page via drag and drop. My application runs fine and I also get into dfu mode by pressing the button -> LED lights up. But there's no advertising. Also, if in dfu mode, the bootloader doesn't jump back to my application after the time specified in the sdk_config.
I don't know what I'm doing wrong, but I think it must be something essential.. Hope you can give me some help.

Thanks in advance
Markus

Parents
  • Hi Markus, 

    Please try with the bootloader only first (softdevice + bootloader ) as instructed in the guide. 

    Why are you testing with S132v4.0 ? Note that SDK v14.2 is made for S132v5.0 

    I would suggest to test with the debug variant of the bootloader and step into the code (and check the log) and check why it doesn't advertise. Again, test with bootloader + softdevice first. 

  • Yes i tested Softdevice + Bootloader already before expanding to softdevice + bootloader + application + settings, even without success.

    Oh yes you're right, that was not intentional to use s132 v4. I've tested v5 in the meantime and it also doesn't work :(

    I'll enable the logging function, do more intensive debugging on the softdevice+bootloader version and then report.

  • Please follow the guide and let us know at which step you hit the error. 

  • I followed the guide step by step once again from zero with a fresh sdk. The problem is, that the device doesn't advertise when in dfu mode, so "Step D. Test DFU" after flashing softdevice and bootloader. There were no errors occuring while building the bootloader.

    I know, the example should work out of the box, anyway i decided to enable the logging functionality, here's the result:

    <info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> app: in weak nrf_dfu_init_user
    <debug> app: In real nrf_dfu_init
    <debug> nrf_dfu_settings: Running nrf_dfu_settings_init(sd_irq_initialized=false).
    <debug> nrf_dfu_flash: Calling nrf_dfu_flash_init(sd_irq_initialized=false)...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> app: Initializing the clock.
    <debug> app: Enter nrf_dfu_continue
    <error> app: Single: Invalid bank
    <debug> app: Enter nrf_dfu_app_is_valid
    <debug> app: Return false in valid app check

  • Hi, 

     

    The 32kHz crystal is not included inside the BLE Nano 2, do you have the crystal externally on your PCB ? 

    If you don't you need to change the configuration in sdk_config in the CLOCK setting (CLOCK_CONFIG_LF_SRC) to use RC, also change the softdevice SDH clock setting (NRF_SDH_CLOCK_LF_SRC) to use RC as well.

     

    If you already have the crystal or if you changed to RC and you still have the issue, you would need to debug the bootloader and see where it throws an error. 

  • Hi,

    no i haven't a crystal externally, but it is mounted on the ble nano v2. Have a look at the schematic: https://github.com/redbear/nRF5x/blob/master/nRF52832/pcb/schematic/Nano%20V2.0%20SCH%2020161102.pdf

    component Y1

    I didn't change the settings of the clock in the sdk_config file. Here are my settings, they should have all the default value:

    //==========================================================
    
    // <h> nRF_Drivers 
    
    //==========================================================
    // <e> CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver
    //==========================================================
    #ifndef CLOCK_ENABLED
    #define CLOCK_ENABLED 1
    #endif
    // <o> CLOCK_CONFIG_XTAL_FREQ  - HF XTAL Frequency
     
    // <0=> Default (64 MHz) 
    
    #ifndef CLOCK_CONFIG_XTAL_FREQ
    #define CLOCK_CONFIG_XTAL_FREQ 0
    #endif
    
    // <o> CLOCK_CONFIG_LF_SRC  - LF Clock Source
     
    // <0=> RC 
    // <1=> XTAL 
    // <2=> Synth 
    
    #ifndef CLOCK_CONFIG_LF_SRC
    #define CLOCK_CONFIG_LF_SRC 1
    #endif
    
    // <o> CLOCK_CONFIG_IRQ_PRIORITY  - Interrupt priority
     
    
    // <i> Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice
    // <0=> 0 (highest) 
    // <1=> 1 
    // <2=> 2 
    // <3=> 3 
    // <4=> 4 
    // <5=> 5 
    // <6=> 6 
    // <7=> 7 
    
    #ifndef CLOCK_CONFIG_IRQ_PRIORITY
    #define CLOCK_CONFIG_IRQ_PRIORITY 7
    #endif
    
    // </e>
    
    
    ...
    
    
    //==========================================================
    
    // <h> Clock - SoftDevice clock configuration
    
    //==========================================================
    // <o> NRF_SDH_CLOCK_LF_SRC  - SoftDevice clock source.
     
    // <0=> NRF_CLOCK_LF_SRC_RC 
    // <1=> NRF_CLOCK_LF_SRC_XTAL 
    // <2=> NRF_CLOCK_LF_SRC_SYNTH 
    
    #ifndef NRF_SDH_CLOCK_LF_SRC
    #define NRF_SDH_CLOCK_LF_SRC 1
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval. 
    #ifndef NRF_SDH_CLOCK_LF_RC_CTIV
    #define NRF_SDH_CLOCK_LF_RC_CTIV 0
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature. 
    // <i> How often (in number of calibration intervals) the RC oscillator shall be calibrated
    // <i>  if the temperature has not changed.
    
    #ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV
    #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 0
    #endif
    
    // <o> NRF_SDH_CLOCK_LF_XTAL_ACCURACY  - External crystal clock accuracy used in the LL to compute timing windows.
     
    // <0=> NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM 
    // <1=> NRF_CLOCK_LF_XTAL_ACCURACY_500_PPM 
    // <2=> NRF_CLOCK_LF_XTAL_ACCURACY_150_PPM 
    // <3=> NRF_CLOCK_LF_XTAL_ACCURACY_100_PPM 
    // <4=> NRF_CLOCK_LF_XTAL_ACCURACY_75_PPM 
    // <5=> NRF_CLOCK_LF_XTAL_ACCURACY_50_PPM 
    // <6=> NRF_CLOCK_LF_XTAL_ACCURACY_30_PPM 
    // <7=> NRF_CLOCK_LF_XTAL_ACCURACY_20_PPM 
    
    #ifndef NRF_SDH_CLOCK_LF_XTAL_ACCURACY
    #define NRF_SDH_CLOCK_LF_XTAL_ACCURACY 7
    #endif
    
    // </h> 

    I've anbled logging functionality on the clock module in the sdk_config, here is the new log:

    <info> app: Inside main
    <debug> app: In nrf_bootloader_init
    <debug> app: in weak nrf_dfu_init_user
    <debug> app: In real nrf_dfu_init
    <debug> nrf_dfu_settings: Running nrf_dfu_settings_init(sd_irq_initialized=false).
    <debug> nrf_dfu_flash: Calling nrf_dfu_flash_init(sd_irq_initialized=false)...
    <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    <debug> app: Initializing the clock.
    <info> clock: Function: nrf_drv_clock_init, error code: NRF_SUCCESS.
    <debug> app: Enter nrf_dfu_continue
    <error> app: Single: Invalid bank
    <debug> app: Enter nrf_dfu_app_is_valid
    <debug> app: Return false in valid app check

    There's one more entry now, which says: drv_clock_init -> success.

    Because of the debugging, I don't know exactly where and when an error happens because no real error messages occur except of the "Single: Invalid bank" log message. Is that message normal, because there was no valid application found?

  • Please double check if you have the 32kHz crystal or not. I worries the schematics you sent is just a reference schematic of what you should have to use the module (for example the 16MHz crystal is not in the schematic).

    It could be very easy to test by just testing with a normal BLE example that use 32kHz crystal in our SDK. 

    "Invalid bank" is normal as you don't have valid application before a successful DFU. 

     

     

Reply
  • Please double check if you have the 32kHz crystal or not. I worries the schematics you sent is just a reference schematic of what you should have to use the module (for example the 16MHz crystal is not in the schematic).

    It could be very easy to test by just testing with a normal BLE example that use 32kHz crystal in our SDK. 

    "Invalid bank" is normal as you don't have valid application before a successful DFU. 

     

     

Children
Related