Hi all,
I have to measure the frequency of a PWM signal routed to one of the nRF52840 GPIO pins.
The signal frequency is ~3MHz.
The measurement is done with the help of two timers, the code is taken from this thread:
As long as the PWM frequency on the GPIO pin is below ~2.66 MHz, the measured value is correct, here some results for different frequencies (generated with a signal generator):
Input Frequency 1.5MHz:
Input Frequency 2.5MHz:
If i increase the frequency to 3 MHz, the measured value is incorrect:
According to this thread the nRF52 is not able to measure frequencies above 2.66 MHz. Is this true??
I have - additional to this problem - another problem with the code:
I have a button on my PCB, which I am currently using to toggle a LED, here is the code:
Initialization of the GPIO button input:
Button callback function:
When I initialize and use the button like this WITH the timer code shown above, it does not output the frequency to the console. Instead, only the button's callback function is constantly called (the white LED then flashes constantly). It is as if the counter interrupt from my high frequency signal triggers the button's interrupt. Do I have to delete an interrupt flag in the timer interrupt?
Thanks for your support.
Best Regards
hypn0