The fastest way to read out a digital pin state in an Arduino Due What is the fastest way to read a digital pin status in an Arduino Due? Is it possible to achieve speed in the Nanosecond area?

With which type of code I can achieve this?

Edit: This question is not a duplicate please see my comment.
If the pin is declared as input, let's say pin 13:

uint32_t pin_status;
pin_status = PIOB-&gt;PIO_PDSR &amp; PIO_PDSR_P27;


If the pin is declared as output, let's say pin 13:

uint32_t pin_status;
pin_status = PIOB-&gt;PIO_ODSR &amp; PIO_ODSR_P27;