Forum Discussion

Ragul's avatar
Ragul
Icon for New Contributor rankNew Contributor
2 years ago

how to check the GPIO's which are available in *.dts file in linux.

Hello,

I am using terasic DE10-nano.For this i downloaded the linux BSP micro SDcard image

from this site:https://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=165&No=1046&PartNo=4#contents . to boot my system.

That image file has a hardware design which has GPIO's and so on. In the dts file we able to see those GPIO's .

now we want to access these GPIO in linux . we wanted to identify them in linux so that we can set the direction as input and output.

we have checked in /sys/class/gpio folder , we could not see all these GPIOs.

we want to access all the GPIO in my c Code. Please help us to identify how shall we access these GPIO and how do i see them in Linux

The below attached image provides the GPIO informations.which are in the *.dts file*.dts

Your help is highly appreciated

With regards,

Ragul V.

2 Replies

  • Jeet14's avatar
    Jeet14
    Icon for Frequent Contributor rankFrequent Contributor

    Hi,


    You may need to boot your board once with the linux binaries/images.

    From the log you can identify the gpiochip_id, the base address of gpio and the number bits configured in the gpio controller w.r.t your device tree *.dts file.


    example from the boot log-

    gpiochip_find_base: found new base at 480

    gpio gpiochip0: (/soc/gpio@0xf9000270): added GPIO chardev (254:0)

    gpio gpiochip0: registered GPIOs 480 to 511 on /soc/gpio@0xf9000270


    *.dts file is having the node--> gpio@0xf9000270 with 32 bit.


    Same you can verify from your boot log and the device tree. Later on export the gpio and set the direction. Reference-https://www.ics.com/blog/gpio-programming-using-sysfs-interface


    Regards

    Tiwari


  • Jeet14's avatar
    Jeet14
    Icon for Frequent Contributor rankFrequent Contributor

    Hi,


    I believe your inquiry has been answered. With that now, I transition this thread to community support.

    Thank you.


    Best regards,

    Tiwari


    p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 4/5 survey.