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

Unable to advertice when NRF_CLOCK is on

Hi, i am working on RTC to create custom clock to measure time it is working fine but when i initialise ble stack and softdevice and adverticeinit it is not working. and my device is not even adverticing here is my code.

CODE:1

NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 1;
NRF_CLOCK->LFCLKSRC = CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos;
NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK->TASKS_LFCLKSTART = 1;
while(NRF_CLOCK->EVENTS_LFCLKSTARTED == 0);

// Configure the RTC for 1 minute wakeup (default)
CAL_RTC->PRESCALER = 0xFFF;
CAL_RTC->EVTENSET = RTC_EVTENSET_COMPARE0_Msk;
CAL_RTC->INTENSET = RTC_INTENSET_COMPARE0_Msk;
CAL_RTC->CC[0] = m_rtc_increment * 8;
CAL_RTC->TASKS_START = 1;
NVIC_SetPriority(CAL_RTC_IRQn, CAL_RTC_IRQ_Priority);
NVIC_EnableIRQ(CAL_RTC_IRQn);  

CODE:2

ble_stack_init();
gap_params_init();
services_init();
advertising_init();
conn_params_init();

here the problem if i add bothe features CLOCK andBLE in my app it is not working. if i comment either one of the CODE 1 or CODE 2. uncommented functionality is working. what may be the issue here.

Parents
  • You cannot directly access clock (registers, IRQs) when SD is enabled. Also, you cannot use RTC0. Both of these peripherals are used by softdevice. Why you want to manually start LFCLK, if it is started by ble_stack_init()? You should read softdevice specification (available on infocenter) - there is more description about restricted peripherals.

Reply
  • You cannot directly access clock (registers, IRQs) when SD is enabled. Also, you cannot use RTC0. Both of these peripherals are used by softdevice. Why you want to manually start LFCLK, if it is started by ble_stack_init()? You should read softdevice specification (available on infocenter) - there is more description about restricted peripherals.

Children
No Data
Related