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

  • Examples are prepared for nRF5x Dev Kits. Which projects you used? Is at least RTT/UART debug logging working? Does your module have all the external components populated (mainly LF crystal)? Hard to help just based on photos;)

  • 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);
        .
        .
        .
    
  • Actually, I bought this module from a website in China and the only resource that I have is the photo. 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. It is true that the examples are meant for Devkits, however, I believe they are actually for the NRF52832 IC and not the Dev Kits so that with some modification they can work with any module. it seems that the module has all the necessary components because I was able to run the Blinky example. I inserted the codes for using LFCLK RC oscillator and the result is the same and I don't get anything from the device. I will go for another DevKit, however, the problem remains a mystery for me. RTT connects to the device. But it just connects and I don't get any debugging from it.

    image description

  • 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.

  • I changed the module because I was suspicious that it may be corrupted. Now, everything works nicely with the new one. Sigurd thanks for the comments. The codes about LFCLK are right.

Related