Using DE10-nano GPIO1/GPIO0 from Linux

I’m trying to use GPIO on DE10 connectors JP1/JP7. From documentation I assumed these IOs directly accessible from HPS.

However, by using various demo C code I only managed to access user LED which also blinks under control of the FPGA. The rest of GPIO remain in high-Z (1.6V).

I also tried to operate GPIOs via /sys/class/gpio interface. After exporting all available numbers I have gpio427 to gpio511 directories under /sys/class/gpio. But still writing to gpioX/direction and gpioX/value files has no effect on the lines on JP1/JP7.

Do I have to configure anything else before accessing GPIO from HPS?


Do you configured these pins as GPIO in your DT?

I’m trying to do the same with a DE0 board. Did you ever figure this out?

Hello @bfk,
@Mikernl is right - GPIOs (and its controller) have to be specified at DeviceTree file (.dtb) and Your operation system has to contain driver for GPIO.
Default images of SD card contain both of them, so GPIOs should be controlled via its driver-files

  • /sys/class/gpio/export,
  • /sys/class/gpio/unexport,
  • /sys/class/gpio/gpioXXX/direction and
  • /sys/class/gpio/gpioXXX/value,

where XXX is number of GPIO from Linux point-of-view.
Which image of SD card are You using? Or have You compile and create it Yourself?
Best wishes
Jan Konečný.

The gpio0 and gpio1 pins are not connected directly to the HPS, they are connected to the FPGA.
In order to command the GPIO using the HPS you would need to foward the pins to the HPS in your Platform Designer (Qsys) project.
You can read the following example, it is for another board but the principle is the same.

Thanks everyone. I ended up repurposing the LED example from the user manual to get this done. Unfortunately some of the paths in the makefile were outdated, but once I sorted all that out it worked fine.