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

RTC Example - incorrect???? per the 51422 (6310 sdk) examples??

Thanks for all your help. From 30-yr programmer and new bit-banger.

Playing with the 6310 example, rtc_example, the following code makes no sense to us with the toggle directives in the source..

/** RTC0 interrupt handler. * Triggered on TICK and COMPARE0 match. */ void RTC0_IRQHandler() { if ((NRF_RTC0->EVENTS_TICK != 0) && ((NRF_RTC0->INTENSET & RTC_INTENSET_TICK_Msk) != 0)) { NRF_RTC0->EVENTS_TICK = 0; nrf_gpio_pin_toggle(GPIO_TOGGLE_TICK_EVENT); }

if ((NRF_RTC0->EVENTS_COMPARE[0] != 0) && ((NRF_RTC0->INTENSET & RTC_INTENSET_COMPARE0_Msk) != 0)) { NRF_RTC0->EVENTS_COMPARE[0] = 0; nrf_gpio_pin_write(GPIO_TOGGLE_COMPARE_EVENT, 1); } }

a. Note the last phrase - events_compare[0] = 0; Watching the code in the Keil debugger, we can't see that the value ever changes to 0.

b. Per Nrf512 ref, pg, 72, it's described that a Compare event is only triggered when Counter "transistions from N-1 to N", etc..

c. We don't see any provision to (a. reset Counter (to a value of less than CC[0]) or to modify the Counter to a value less than CC so subsequent triggers will occur.???

d. The code might imply that the second LED is supposed to Toggle ?? It does not, since there's no reset to the Counter nor CC[0] to enable counter to approach and reach it again.

e. Is there an example of how this should actually look to work correctly. What is the correct technique to get the lower (Compare) phrase to cycle???

tks again!

Parents Reply Children
No Data
Related