we wanted to use the gpio functions on the Arduino Due board and it seems the gpio_read() function doesn't use the right register.
For example, for GPIO_0, the function returns: GPIO_0_DEV->PIO_PDSR & GPIO_0_PIN
PIO_PDSR corresponds to Pin Data Status Register, so we tried with PIO_ODSR which is Output Data Status Register:
Now for GPIO_0, the gpio_read function returns: GPIO_0_DEV->PIO_ODSR & GPIO_0_PIN
And it seems to fix our problem.
Did anyone already notice this ?