2022-09-12 04:46 PM
I'm interested in trying to synchronize my system to USB start of frame packets. I'm using the CRS system to generate an HSI48 clock. I've considered running that HSI48 clock into MCO and using that as an external clock for a timer. This would enable that timer to be frequency synchronized with the USB clock, but no way to actually set the phase on that clock from what I can find. I'd like my timer to run at 10 kHz, but be phase synchronized to the USB SOF. Any ideas?
2022-09-13 01:22 AM
What is the purpose of that timer?
One straightforward solution is to use the SOF through the slave-mode controller in reset mode (I don't know what the connections are, whether the SOF inputs into timer as CH1 or CH2 allowing this).
Another possibility is to use SOF to capture the timer's counter, and adjust timer in software accordingly. It may be difficult to adjust the counter itself; if you need the timer to generate a signal through its compare, I'd simply "acknowledge" whatever is the phase shift, by shifting the compare value accordingly.
Note, that there are undefined latencies of one-two timer cycles in the way, so you may need to fine-tune things.
JW