Other Parts Discussed in Thread: TDA4VM
Dear TI team,
we're currently trying to synchronize the timer hardware of our AM6548 with the CPTS, and we have some questions regarding the general approach to solve this problem.
Our setup is:
- TI AM6548 SR2.0
- PROCESSOR SDK RTOS 07.01
Our application configures the NAVSS CPTS to synchronize its counter value with an external time source (which is our reference time base). This is working fine.
We want to trigger certain software events at a given time in our reference time base, and we want to have this time base accessible to code running on an R5f core. In order to do this, we want to use the timer hardware (section 12.8.3 in the TRM Rev. E, sometimes called DMTimer) to trigger interrupts.
The CPTS GENF signal is routed to the timer clock input (TIMER0_FCLK). This allows us to tune the timer counter to run at the same frequency as the CPTS. However, we still need to know the offset between both counters.
If we could route the timer compare output to a CPTS HW_TS_PUSH signal, this would solve our problem. Our software could program the timer compare register and could wait until the corresponding time stamp in the event FIFO of the CPTS would be generated. The difference between the time stamps would be our required offset.
Another possible solution would be to route (another) CPTS GENF signal to the capture input of the timer.
However, both of these routings are not possible.
As a workaround we did the following:
- Configure the CPTS.
- Configure the CPTS GENF signal to start at a known time in the future.
- Route the CPTS GENF signal to the reference clock signal of the timer.
- Configure the timer hardware.
- Wait until the GENF signals starts (and the timer starts to count).
- Now, we know that the timer starts to count at our configured time and we know the offset between both time bases.
However, this approach has got some flaws:
- If we use the timer hardware in "non-posted mode", all register accesses will hang forever before the GENF signal is running. The reason is that the register access will be synchronized with the next tick of the timer's clock domain. And since the clock is not running, the synchronization will stall indefinitely.
- We found that "posted mode" might allow us to work around that problem, but the TRM in section 12.8.3.4.12, is unclear whether that is allowed, or what drawbacks it might have ("it is not recommended to access the timer registers prior to the PLLs generating the timer and interface clocks have been configured and the clocks have stabilized"). "Not recommended" is a rather useless term in this context. Should it work? What side effects should we expect?
We've currently implemented the above workaround with posted mode, and it seems to be working, but we don't know if this is "safe".
If the timer registers really shouldn't be acccessed before the timer's functional clock is stable we would have to wait for the GENF signal to be available, and then start configuring the timer. That way we wouldn't have control over the offset between the CPTS counter and the timer counter, and would require a way to synchronize the timer with the CPTS.
Are there any alternatives?
There is a thread where Karan Saxena outlined something similar for the TDA4VM (https://e2e.ti.com/support/processors/f/791/p/899500/3326239) but that post doesn't contain any details on the step that we're currently missing:
>> Once that is done, we have to configure TimeSync Router(TSR) to route either GTC/DMTimer pulse to HW push of MCU domain CPTS.
Best Regards,
Dominic