Hi Everyone,
The custom device I am working on is a BLE peripheral device and uses softdevice S132,
therefore to get accurate triggering of ADC sampling and to avoid periodic CPU blocking by the radio,
I am trying to get RTC to trigger the ADC without any CPU involvement. Also currently, the custom function
I use for ADC sampling is a blocking function ( increased power consumption from CPU idling ) therefore I hope by using PPI and RTC, I can also reduce the
overall power consumption.
Looking at the RTC example provided in SDK v13, I can see that that rtc in repeat mode is done by calling the rtc_cc_set function
in the rtc interrupt on compare event.
My question is this, will I be able to run the RTC in repeat mode without the use of the interrupt function as it can be blocked by the radio interrupt?
I can disable the rtc interrupt ( SDK v13 requires an interrupt handler to be passed ) and use rtc clear task with PPI to reset the rtc counter , but I can see that the cc value is set in the rtc_cc_set function in the interrupt.
Is this required ? if I set the cc value once, I presume it will be retained even after calling the rtc clear task?
In the IRQ handler for rtc, the compare event register is cleared, if I were to disable the interrupt, then there would be no way of clearing this register using PPI.
However, is it necessary to clear the compare event register manually, would it go low if were to clear the counter and then high again?
In summary what I would likely to do is to set the cc value once, clear the counter using ppi on compare event ( forked to trigger adc sampling ) and wait for the next compare event.
Alternatively, I can leave the interrupt as it is with the rtc_cc_set function but then do the clearing with PPI, as long as the counter is cleared straightaway and the compare event register
and cc value is cleared/set a few cycles before the counter reaches the cc value ( ie cc time interval < 1/sampling_freq ) then this would be fine?
Thanks.