Hi,
We wish to detect a 4MHz clock signal on one of the GPIOs by the M7 core to sample in data.
This is being done by reading IO0 of the GPIO4 peripheral.
Here is a snippet of some code we use to profile/test the detection of the clock signal:

What we find is that the M7 fails to accurately detect the signal running at 4MHz.
We can reduce the speed of the signal to toggle at 1MHz in which the M7 GPIO accurately detects the changes just fine, however Increasing the speed, we have problems when reading the GPIO Input signal.
This should not be a problem as we have configured the speed of the M7 to operate at 800MHz with the GPIO peripheral Running at 200MHz:

We are wary that on some ICs there can be GPIO speed settings and wondering if anything like this exists for the M7?
Do you have some metrics for what is the max toggle frequency a GPIO Input signal can accurately trace?
Any help to try and resolve issue would be greatly appreciated.