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

How to change ble_app_uart example to work without LFCLK?

I'm using SDK12 and SES.

I compiled my code based on ble_app_uart example for nRF51822_QFAA and I see in Memory usage that RAM is at correct addresses (finishes at 0x20003FFF). The code runs on PCA10028 but it doesn't run on my target board that has no 32.768kHz oscillator.

I can't find how to put the controller working without LFCLK. Can anyone give a hint?

It is frustrating that I loose 90% of time looking for solutions to put things running rather than coding... very poor documentation about examples cause this!

Parents
  • Hi,

    The clock is configured in the ble_stack_init() function in main.c of the ble_app_uart example, by this code:

        nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
    
        // Initialize SoftDevice.
        SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);

    The NRF_CLOCK_LFCLKSRC is defined in the board file so to use the RC oscillator instead of the LFXC, you should either update that, or simply skip it and do like this:

        nrf_clock_lf_cfg_t clock_lf_cfg = {.source        = NRF_CLOCK_LF_SRC_RC,                \
    																			 .rc_ctiv       = 16,                                 \
                                           .rc_temp_ctiv  = 1,                                  \
                                           .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM};
    
        // Initialize SoftDevice.
        SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);

Reply
  • Hi,

    The clock is configured in the ble_stack_init() function in main.c of the ble_app_uart example, by this code:

        nrf_clock_lf_cfg_t clock_lf_cfg = NRF_CLOCK_LFCLKSRC;
    
        // Initialize SoftDevice.
        SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);

    The NRF_CLOCK_LFCLKSRC is defined in the board file so to use the RC oscillator instead of the LFXC, you should either update that, or simply skip it and do like this:

        nrf_clock_lf_cfg_t clock_lf_cfg = {.source        = NRF_CLOCK_LF_SRC_RC,                \
    																			 .rc_ctiv       = 16,                                 \
                                           .rc_temp_ctiv  = 1,                                  \
                                           .xtal_accuracy = NRF_CLOCK_LF_XTAL_ACCURACY_250_PPM};
    
        // Initialize SoftDevice.
        SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL);

Children
Related