I am trying to measure the frequency of the square wave on the ARDUINO_6_PIN on the NRF52840 Dev Kit. 
It seems like it works well until the square wave goes above 2MHz. Is this the maximum speed that this method can achieve or is there something else I need to do, (or another method I could use)?







(My function generator cannot go above 6MHz itself so I generated the square wave on ARDUINO_7_PIN on the NRF52840)
To create this program I started with gpiote peripheral example in the nRF5_SDK_17.1.0_ddde560 and edited the sdk_config.h and the main.c linked here. (Down below because I am an idiot)