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

NRF52 BLE examples not working with gcc

After working with NRF51822, I decided to go for NRF52832, and I bought some modules that have NRF52. I am using GCC and SDK13. I installed the S132 soft device which is in "sdk13\components\softdevice\s132\hex" using NRFGo. Then, I compiled and tested the blink example which is in "blinky\pca10040\s132", and it worked perfectly. However, none of BLE examples don't work at all. I tested many samples like "ble_peripheral\ble_app_beacon". However, the device doesn't advertise. I've done all the necessary things completely. Even the blinky example works, and I don't know why BLE examples are not working. Please, help me

This is the module that I am using image description

Parents
  • Hi,

    Assuming that the board don't have a LFCLK crystal oscillator, you will need to use the LFCLK RC oscillator. For SDK 13 you can change this in ble_stack_init()

    Code snippet:

    static void ble_stack_init(void)
    {
        ret_code_t err_code;
    
        nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
        clock_lf_cfg.source = NRF_CLOCK_LF_SRC_RC;
        clock_lf_cfg.rc_ctiv = 32;
        clock_lf_cfg.rc_temp_ctiv = 2;
            
    
        // Initialize the SoftDevice handler module.
        SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);
        .
        .
        .
    
  • It seems that the module has a crystal on it which can be seen in the photo. I don't know whether is it for LF or anything else

    From the picture it looks like it only have a 32MHz HF crystal, not a LF 32 KHz crystal. The ble_app_beacon example will not output anything on the RTT by default. You will need to enable the nrf_log for that. I.e. set NRF_LOG_ENABLED to 1 , and set NRF_LOG_BACKEND_SERIAL_USES_UART to 0 and NRF_LOG_BACKEND_SERIAL_USES_RTT to 1, in sdk_config.h

    Did you see any BLE activity with nRFConnect after the code change(to use RC oscillator) with the ble_app_beacon example?

    For development I would recommend buying a nRF52-DK. The board also have a on-board Segger J-Link programmer/debugger.

Reply
  • It seems that the module has a crystal on it which can be seen in the photo. I don't know whether is it for LF or anything else

    From the picture it looks like it only have a 32MHz HF crystal, not a LF 32 KHz crystal. The ble_app_beacon example will not output anything on the RTT by default. You will need to enable the nrf_log for that. I.e. set NRF_LOG_ENABLED to 1 , and set NRF_LOG_BACKEND_SERIAL_USES_UART to 0 and NRF_LOG_BACKEND_SERIAL_USES_RTT to 1, in sdk_config.h

    Did you see any BLE activity with nRFConnect after the code change(to use RC oscillator) with the ble_app_beacon example?

    For development I would recommend buying a nRF52-DK. The board also have a on-board Segger J-Link programmer/debugger.

Children
No Data
Related