Hi, I have a problem with the HFCLKSTARTED interrupt.
I can't have it. (I'm a little bit pressed with time I have to send a document in 2 days, so if you can quick respond to my 2 simple questionS first, and maybe later have a look for the rest you will be very nice :-))
MY SIMPLE QUESTION 1 : can whe stop the HFCLK and directly going to sleep calling __wfi() ?
doing that
nRF_POWER->TASKS_LOWPWR = 1UL; // instruction 1)
NRF_CLOCK->TASKS_HFCLKSTOP = 1; // instruction 2)
__WFI(); // instruction 3)
MY SIMPLE QUESTION 2 : What's happening between the instruction 2 and 3 ??? is there the time for the RC to start to execute __WFI ?
I make a program who is in low power mode and sleep calling __wfi() with HFCLK stopped.
perriodicaly it wake up with the RTC. In the RTC_irq I start the HFCLK and to save power by go directly in low power mode and sleep calling __wfi(), waiting the HFCLK
and after I normaly get the HFCLKSTARTED interrupt where I can send a data by bluethoot. But I never get it. and with the debuger I'm get blocked in the "arm_startup_nrf51.s(startup)" file.
My program:
int main()
{
initALL();
while(true)
{
NRF_POWER->TASKS_LOWPWR = 1UL;
if(HF_Clk_Stay_On_To_Sleep == false) NRF_CLOCK->TASKS_HFCLKSTOP = 1;
__WFI();
}
}
rtc_IRQ(void)
{
NRF_CLOCK->TASKS_HFCLKSTART = 1; // start HFclock
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0; // clear clock event
HF_Clk_Stay_On_To_Sleep = true;
NRF_RTC0->TASKS_CLEAR = 1UL; // clear RTC event
NRF_RTC0->EVENTS_COMPARE[0] = 0; // clear RTC event
}
HFclock_IRQ(void)
{
HF_Clk_Stay_On_To_Sleep = false;
Radio_Send_Data(); // send a data by radio
}
Is there something I make wrong ? if you have an idee tell me. Thank you very much for your time.