Fastest way to read ARM cycle counter into PRU

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:

  1. PRU waits in the initialization process to receive the ARM cycle counter

  2. Write ARM cycle counter into PRU-DRAM

  3. PRU sets his own counter to this value divided by 5 (+2 for the ram read and register write)

  4. PRU waits for GPIO event

  5. On GPIO event save own counter state, multiply by 5 and message it to ARM

  6. ARM compares his cycle counter to the messaged one and knows when the GPIO event occured

Any thoughts how to improve?

Thanks, Steve

Maybe just a single question instead of the above:

=> Can the PRU read the ARM cycle counter directly or predictably?