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

NRF 51822, RTC 0 or RTC 1 together with BLE.

Good afternoon. I use NRF 51822, and I want to use RTC 0 or RTC 1. But there are problems, if I do not initialize BLE then the compiler does not execute LFCLK_config because of #ifndef SOFTDEVICE_PRESENT. If I get around this, interruptions cease to occur. Tell me how you can switch the use of the RTC between tasks in one project. I sometimes need to transfer data to the phone, at this time I not use the RTC.

Parents
  • I solved the problem.

    static void lfclk_config(void)
    {
    nrf_clock_xtalfreq_set(CLOCK_CONFIG_XTAL_FREQ);
    nrf_clock_lf_src_set((nrf_clock_lf_src_t)CLOCK_CONFIG_LF_SRC);
    nrf_drv_common_irq_enable(POWER_CLOCK_IRQn, 3);
    __disable_irq();
    *((volatile uint32_t *)((uint8_t *)NRF_CLOCK + NRF_CLOCK_TASK_LFCLKSTART)) = NRF_CLOCK_TASK_TRIGGER;
    nrf_task_triger((uint32_t*)NRF_CLOCK,NRF_CLOCK_TASK_LFCLKSTART);
    __enable_irq();
    }

Reply
  • I solved the problem.

    static void lfclk_config(void)
    {
    nrf_clock_xtalfreq_set(CLOCK_CONFIG_XTAL_FREQ);
    nrf_clock_lf_src_set((nrf_clock_lf_src_t)CLOCK_CONFIG_LF_SRC);
    nrf_drv_common_irq_enable(POWER_CLOCK_IRQn, 3);
    __disable_irq();
    *((volatile uint32_t *)((uint8_t *)NRF_CLOCK + NRF_CLOCK_TASK_LFCLKSTART)) = NRF_CLOCK_TASK_TRIGGER;
    nrf_task_triger((uint32_t*)NRF_CLOCK,NRF_CLOCK_TASK_LFCLKSTART);
    __enable_irq();
    }

Children
Related