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

is ppi thread safe?

I have a thread using a Timer and PPI to trigger SAADC sampling at 100hz. Currently I have an app_timer also running at 100hz to sample the results of the SAADC (and its time stamp) and send notifications. However I am noticing time jitter due to the fact I'm using the CPU to send the HVX notifications. If I use a Timer and PPI to trigger the HVX calls in my BLE thread, will that cause concurrency issues since I also use PPI and Timers in my SAADC Thread?

Parents
  • Hi Dave

    All the PPI channels can operate in parallel, there is no risk of one PPI channel affecting another.

    That said, you can not send a notification based on a PPI connection alone. The HVX call is a software function and needs to be triggered by running some code in the MCU.

    Calling the HVX function will only buffer the packet in the stack, and it will be sent on the next connection event, so there might be some jitter here, but you should be able to make the SAADC sampling itself jitter free.

    Best regards
    Torbjørn

  • Thanks for the response. I decided to increment my timestamp as the ADC samples return in the interrupt callback function. Since I know the time between each successive ADC sampling is consistent via TIMER+PPI this should guarantee accuracy timestamp keeping. Even if BLE interrupts the ADC callback or any other CPU. The time associated with the sample will still be valid since it was triggered w/o the CPU.

Reply
  • Thanks for the response. I decided to increment my timestamp as the ADC samples return in the interrupt callback function. Since I know the time between each successive ADC sampling is consistent via TIMER+PPI this should guarantee accuracy timestamp keeping. Even if BLE interrupts the ADC callback or any other CPU. The time associated with the sample will still be valid since it was triggered w/o the CPU.

Children
No Data
Related