To access jetson nano gpio pins using c program

Hi Sir,
i am trying to access gpio pins in jetson nano development kit ,i would like to perform i2c , spi and uart applications in jetson nano using c program but i couldnt find any tutorial or documents what i am looking for,i could only able to find examples in python version, please guide me and please share the needful documents and tutorial links to access gpio in jetson nano in c version.

hello rahul14ee,

suggest you refer to Topic 1049116 for Python GPIO support.
you might also check Topic 1030443 for tutorials showing how to use GPIO.
please also refer to Topic 1052582 about Jetson.GPIO.
thanks

There are some good examples in C here: https://github.com/torvalds/linux/tree/master/tools/gpio

I have successfully compiled and used gpio-hammer on the Jetson Nano. Hope this helps.

@JerryChang you will note that @rehul14ee asks for C programs, and is complaining that they can only find Python programs. Posting a reference to a Python GPIO topic is unlikely to actually help, and instead just gives the impression that NVIDIA technical support people don’t actually read the questions they answer.

For @rehul14ee benefit: The Jetson uses Linux, and all the UART/SPI/I2C/GPIO pins are handled using the Linux device driver interfaces, which you can find tutorials on in various places on the net.
It doesn’t have to be a Nano-specific tutorial, because all Linux systems use the same driver API.
(That being said, the specific mapping from GPIO pin number to device number is device specific, and you have to refer to the Nano documentation to know what the device numbers are.)

hello rahul14ee,

there’s some APIs to control GPIOs.
$l4t-r32.1/public_sources/kernel/kernel-4.9/include/linux/gpio.h

you may also refer to camera sensor drivers for the usage.
for example,
$l4t-r32.1/public_sources/kernel/nvidia/drivers/media/i2c/imx185.c

GPIO pin number is depends-on platform devices, you might also refer to Jetson TX2 Platform Adaptation and Bring-Up Guide,
please check the [GPIO Changes] session for the steps of GPIO number calculation.
thanks