Hi, I am using timer TC4 to generate pulse to trigger camera like Martin’s suggestion using MFRQ mode, and send pulse in TC4_Handler(). Using timer TCC2 to generate pulse for PPS like Martin’s suggestion.
Now the problem is :
I need to do time sync this two timers. When TC4 generate pulse, I will measure time(t_1) in the TC4_Handler(); When TCC2 generate pulse, I will measure time(t_2) in TCC2_Handler(); t_1 and t_2 need to be in same time line. I prefer use TCC2's time to sync TC4's time, since TCC2 is generate PPS.
My idea:
I found Martin’s suggestion for micros2(), use another timer TC3 to count time as the "System time" since micros2() will more precise. Then use TCC2's time to correct TC3's time. Then micros2() can be used TC4_Handler() to measure time.
My questions:
- how to count TCC2 time, TCC2 is configured as MPWM mode, generate 1s period with 10% duty circle(100ms).
- how to use TCC2 time to correct TC3 time.
- Or any other suggestions to sync TCC2's time to TC4.
Thanks for the suggestions.