I try to make the clock signal detector on KE02Z. External clock signal is connected to KE02Z. I have not decided exactly what use for this, SPI or FTM and or something else.
Seemingly simple task . If there is external clock signal, on some KE02Z pin must be = 0. If no external clock signal, must be = 1. But problem is, Clock signla may be from 50kHz to 4MHz, and clock word may be from 1 clock period to 18. Timeout between clock word from 15us to 50us. Clock signal idle state is 1.
While I think may be possible to do it with SPI Slave. SPI Slave has receiver full flag (SPRF). If read SPRF flag , can to determine, there is external clock or no. But what next? If SPI slave will get 4 clock periods? SPRF will in expectation for next 4 period (if it wait for 8 bit)
Maybe someone has already done something similar or have any ideas how to do it.