Does anyone know how to detect the clock frequency, distinguish
it whether it is below or above 10MHz within +/-10% deviation ?
I need all the components on chip and operating current as
low as 50uA.
If you have watchdog in your mcu , make active it , and start counting where counter is in memory location
In AVR watchdog is supplied from different oscillator .
You should check watchdog implementation in your mcu for that . When watchdog reset will be happened get the counter value . Using precalculated counter values , you can easely find mcu's clock frequency .
Well , if you mcu has GPIO ports (assuming the topic was about clock detection with mcu) configure 2 ports one as output and another as input and connect them .
The idea is about port has some level establishmen time - when you output 1 or to port it should take some time till its level will be set . Invert the data on out port and start reading the from input port together with intenal counter incrementing . The higher freq - the higher counter valaue will be .
Or the same trick can be done with capasitor and one GPIO port . Connect capasitor and resistor with known t = r*c to GPIO port . Configure port as output and charge the capasitor via sending 1 .
Then reconfigure the port as input and begin reading
from port in loop together with internal counter incrementation . R and C value will define how long it takes to discharge the capsitor - that is time duration reference .
Or make the delay circuit for 100 nsec and compare delay output and input . If freq above 10 MHz you will get 1 if writing input to trigger on delayed signal rising edge . And opposite - get 0 if freq below 10 MHz .