How to develp jetson tx2 gpio

my jetson tx2 will connect to robot arm with pin 40 of tx2 board.
use GPIO how to programming with pin 40 ?
where is the develop documents?
example and lib only have python?
do you have c++ version?

thanke you for help

Please refer to Topic 144550, for several ways to access GPIOs. such as, kernel APIs, python scripts, C++ samples.

thank you for your answer

I installed the GPIO lib only have python samples,also c++ can call this lib directly?

hello double-lee,

as you can see, there shows standard APIs to access GPIO.
you may include the header file to control them in your c++ implementation.

where can I download the c/c++ library of GPIO?
I am currently developping on jetson tx2 nx

could you provide some install command or web-address? (c/c++ library of GPIO)

hello double-lee,

they’re actually kernel headers.
please check Jetson Linux Archive | NVIDIA Developer to download [L4T Driver Package (BSP) Sources] package for your release version.

if already install L4T , dir. of the c/c++ library will be where?

how to validate that?

thank you

I downloaded the L4T and discompress it
I running the “./”,
it occur a error :
Error: Env variable NV_TARGET_BOARD is not set!!
how can I do ?

I find out the gpio.h and look that,
it only have six struct and several #define, nothing esle!
I can’t find anyone api function ! ?

hello double-lee,

don’t you see GPIO functions, such as… static inline int gpio_set_value(unsigned int gpio, int value).
you may have kernel driver implementation to call those for controlling pins.
for example, ov5693 camera driver,

static void ov5693_gpio_set()
                if (gpio_cansleep(gpio))
                        gpio_set_value_cansleep(gpio, val);
                        gpio_set_value(gpio, val);

I foud out it in “/usr/src/linux-headers-4.9.253-tegra-ubuntu18.04_aarch64/kernel-4.9/include/linux/gpio.h”, is it ?

do you have C/C++ examples, I don’t know how to use the gpio.h developping!
my program only need includ the gpio.h?

hello double-lee,

I had already point-out the code snippets, you may see-also ov5693 camera driver for details.
for example, $public_sources/kernel_src/kernel/nvidia/drivers/media/i2c/ov5693.c

I want to need GPIO develop documents guid, (c/c++ is batter)
where can download?
I feel very helpless…

I’ve already point-out that. please check my comment #7 which replied on Oct31.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.