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

ppi clearing of event flag

Hi, Does the PPI module automatically clear the event flags for the linked event? For example, if I have the following:

NRF_PPI->CH[0].EEP = (uint32_t)&(NRF_GPIOTE->EVENTS_IN[0]);
NRF_PPI->CH[0].TEP =(uint32_t) &(NRF_TIMER1->TASKS_CLEAR);
NRF_PPI->FORK[0].TEP = (uint32_t)&(NRF_TIMER1->TASKS_START);
NRF_PPI->CHENSET = (PPI_CHENSET_CH0_Set << PPI_CHENSET_CH0_Pos);

Do I need to manually clear NRF_GPIOTE->EVENTS_IN[0] or will the PPI module handle that?

Thank you.

  • Good question Akbar,

    Look at this Figure that shows you the internal of how Peripheral interface is (a peripheral can be a TIMERx , RTC, RADIO etc)

    image description

    The event signal that goes to PPI is internal signal from the peripheral AND not the value of EVENT register itself. If you just connect the PPI to the event of the peripheral then

    1. if you have not enabled the interrupts then EVENT register of the peripheral is always set to 1 since you are not clearing it explicitly. But this does not matter because the PPI is using internal signal of the peripheral and it gets only pulses of events.

    2. if you have enabled interrupt for that event, then PPI will not clear the event register (since PPI is getting only a pulse of this event from the peripheral internal signal). The value of the EVENT register (not the internal signal) is the source for interrupt in ARM NVIC. Here you need to explicitly clear the EVENT register, else your interrupt handler will run forever (as long as its interrupt priority will allow it to run).

    Is this clear?

Related