AM6421: Common timestamp between A53(Linux) and R5 (FreeRTOS)

Part Number: AM6421
Other Parts Discussed in Thread: TMDS64EVM

Tool/software:

Dear TI Experts,

We have the following setup:

0) TMDS64EVM as hardware

1) Processor SDK 10.00.07.04 +  the corresponding Yocto for Linux, Kernel version 6.6.32-ti-01287

2) R5-0-0 and R5-0-1 running in split mode

3) Custom firmware, running on R5-0-0 from SRAM+TMC, with FreeRTOS

4) Implemented RPMSG, respectively IPC between Linux and R5

Our application:

  • we use the R5 to read 8 ch of 24-bit ADC data @ 128ksps pro channel and to transfer the data over shared memory to Linux. This kind of data we call Raw Data
  • we use the R5 to control different hardware, that is attached to several interfaces
  • we use Linux on the A-cores to process the raw data, configure the R5 Application and provide general connectivity to the outer world

What we'd would like to achieve:

  • Basically, we would like to have a common timestamp/timebase between Linux and R5/Freertos
    • We would like to be able to tag the raw data packets, created on the R5 with timestamps
    • For the error handling and event generation on the R5 side, we would like to be able to timestamp those events and errors
    • We want to be able to order and correlate Linux events with R5 events, based on this timestamp. 
  • The time granularity can be between 10us and 100us
  •  The timestamp between Linux/R5 is allowed to have some offset (and probably jitter), x00 ns are perfectly fine

Questions:

  • Which is the best way to achieve that? We already did some research and it appears, that the Time Sync Router + GTC would be the choice (https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1061474/faq-am64x-what-is-the-time-sync-router-for-how-do-i-use-it)
  • In case of the above, it would be better if the target core (R5) is not being disrupted by the GTC/TSR interrupt, but that signal is used to increment a Timer/Counter, whose value then to be read on demand by the R5 application. Is that a plausible solution and what would be the major steps to achieve that?
  • In case of too complex solution, it would be perfectly OK that the R5 reads a register, which stores the current common time. Unfortunately, there is only a brief GTC API explanation in the MCU+ SDK 10.01. 
  • What is the way to read this timestamp (presumably out of the GTC) at the Linux side?
  • In all cases, I suppose the GTC has to be configured from the Linux side. Again, the information there is pretty much missing, except several pages in the TRM, but we were unable to find a DT Entry description for this node. Please advise!

Thank you and regards,

Angel