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

Can't detect nrf51422 with ble scanner on smartphone but blinky example works

Hello, we just made a raw board with the MDBT40, which use a nrf51422 chip. I downloaded SDK version v12.3.0 (which supports nrf51) on the nordic website. With nrfGoStudio I programmed the blinky example (in sdk/examples/periperal/blinky/hex) with a J-LINK and nrfGoStudio. Everything works and I see the LED blinking. Now, the next step is to detect the nrf51422 on my smarthone. So I programmed, with the same idea as the blinky example, the nrf51422 with a lot of examples in the ble_periperal folder, for example experimental_ble_app_blinky_pca10028_s130.hex, I can always program it perfectly with nrfGoStudio, but I can't never detect the nrf51422 on my smartphone. My bluetooth and location is turned on. Anybody who knows what the problem can be?

Parents
  • Hello,

    I see that you have programmed the s130 softdevice, so that should not be the problem.

    Do you have a Low Frequency Crystal on your raw board (32.768khz)? This is typically the issue when an example in the peripheral folder works, but the ones from the ble_peripheral folder does not.

     

    You do not need a low frequency crystal, but if you don't, you need to tell the SoftDevice that you do not have it if. If you do have it, what is the accuracy of the crystal?

     

    Either way, you need to do some changes in the example. This is done a bit differently in the different SDK versions, but for SDK12.3.0, and the experimental_ble_app_blinky example, you will see that in ble_stack_init() function, SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL) is called. If you look at clock_lf_cfg, which is decleared in the line above:

    nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC; This define is found in pca10028.h

    This default define tells the softdevice that it has an LFXTAL, and the accuracy of the crystal/XTAL. 

    If you do not have a crystal, change it to use the RC Oscillator. If you have a crystal, configure the accuracy to fit your XTAL.

    If you want to see the description of the different fields in clock_lf_cfg, check out nrf_sdm.h, line 150 in SDK12.3.0.

     

    To choose the RC oscillator, your ble_stack_init() function should start with something like this:

        uint32_t err_code;
    
        nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
        clock_lf_cfg.source = NRF_CLOCK_LF_SRC_RC;
    
        // Initialize the SoftDevice handler module.
        SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);

     

    You may also want to check the other variables, clock_lf_cfg.rc_ctiv and clock_lf_cfg.rc_temp_ctiv

     

    Best regards,

    Edvin

  • Hey Edvin,

    Thanks for your help. I did al what you said except one 1 thing: i didn't change in the structure nrf_clock_lf_cfg_t the rc_ctiv parameter. This was default 0, but this was not a possible value for that parameter..because of your remark about where I can find the nrf_clock_lf_cfg_t structure, i found this issue.

    Everything works right now! Big thanks Edvin!

    Kind regards

Reply Children
No Data
Related