Hello,
I need to synchronize some actions on arm and pru and therefore need the fastest way to read the ARM cycle counter into the PRU.
I basically want to match up the PRU cycle counter and the ARM cycle counter. Am I right when I assume the ARM cycle counter runs exactly (PLL phase locked) 5 times faster than the PRU’s?
So I want to catch some GPIO event (gps pps) on the PRU and tell the ARM core in a scale of a few nanoseconds when it occured on his time scale.
When ignoring overflowing 32 bit counters my pseudocode would be:
-
PRU waits in the initialization process to receive the ARM cycle counter
-
Write ARM cycle counter into PRU-DRAM
-
PRU sets his own counter to this value divided by 5 (+2 for the ram read and register write)
-
PRU waits for GPIO event
-
On GPIO event save own counter state, multiply by 5 and message it to ARM
-
ARM compares his cycle counter to the messaged one and knows when the GPIO event occured
Any thoughts how to improve?
Thanks, Steve