I am using a MK22FN128VLL10 that has 3 FTMs. 2 are currently used for QD, and the other one is used for multiple PWM channels at 20kHz.
I also have a timing requirement related to Modbus RTU, where I have to be able to accurately detect the 3.5 character delay that defines a complete packet (or clearing buffers in the event of transmission errors).
I am currently reading the FTM section of the reference manual and am going to work on the implementation to see if it works. However, I was hoping that others here with experience trying such a thing would be able to tell me if I'm wasting my time. My specific question is, using FTM0 that is already configured for PWM, is there a way to configure an ISR to trigger on every overflow, then count the number of overflows that would correspond to 3.5 characters?
The overall idea is to keep my Modbus data in a global buffer, and any time the 3.5 character quiet time has elapsed, signal my Modbus listener task to process the data. The overflow counter would be reset, as well as FTMx_CNT if that's a valid thing to do (without screwing up the PWM).