S32G274A-RDB2 board yocto image GPIO set error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S32G274A-RDB2 board yocto image GPIO set error

Jump to solution
2,490 Views
0xEC
Contributor IV

Hi everyone,

I am trying to get familiar with yocto on s32g274a-rdb2 board. I built an image and deploy it into sdcard works with u-boot, kernel etc. I am trying to control user led on the board which is connected to GPIO95, whenever i try to set GPIO by using following command on target:

>> echo 95 > /sys/class/gpio/export

i got following error message:

>> invalid argument

does anyone use GPIOs in s32g274a-rdb2 board from a53 core in yocto manner?

thanks in advance, 

 

 

Tags (3)
0 Kudos
Reply
1 Solution
2,464 Views
MayanksPatel
NXP Employee
NXP Employee

Hi @0xEC,

Thank you for reaching out to us.

you can not toggle GPIO directly because there were gpio controllers available on the board and through that controller, you can change the value of a particular GPIO.

By default, in the Yocto build libgpiod library included by using, you can change the value of GPIO.

Please refer to "S32G2_LinuxBSP_33.0_User_Manual.pdf Chapter-20" for more detail.

Please use the below command which will turn on GPIO95 for 10 seconds.

sudo gpioset --mode=time --sec=10 gpiochip0 95=0 //Turn ON GREEN LED 

sudo gpioset --mode=time --sec=10 gpiochip0 95=1//Turn OFF GREEN LED

 

Hope this helps you.

 

Thanks,

Mayank s Patel

View solution in original post

5 Replies
1,967 Views
ankit0812
Contributor I

I want to access GPIO ports from my c++ application for S32G3 board. Can anyone help me with which library and header files I should include from the bsp-sdk

 

0 Kudos
Reply
2,465 Views
MayanksPatel
NXP Employee
NXP Employee

Hi @0xEC,

Thank you for reaching out to us.

you can not toggle GPIO directly because there were gpio controllers available on the board and through that controller, you can change the value of a particular GPIO.

By default, in the Yocto build libgpiod library included by using, you can change the value of GPIO.

Please refer to "S32G2_LinuxBSP_33.0_User_Manual.pdf Chapter-20" for more detail.

Please use the below command which will turn on GPIO95 for 10 seconds.

sudo gpioset --mode=time --sec=10 gpiochip0 95=0 //Turn ON GREEN LED 

sudo gpioset --mode=time --sec=10 gpiochip0 95=1//Turn OFF GREEN LED

 

Hope this helps you.

 

Thanks,

Mayank s Patel

2,458 Views
0xEC
Contributor IV
hi @MayanksPatel
Thank you for reply,
I did set as you say, it works by gpioset command,
Further question, how can i use gpios in c program, which headers should i use, i am suffering to find documentation about yocto and this board programming in yocto manner.
Best,
0 Kudos
Reply
2,455 Views
MayanksPatel
NXP Employee
NXP Employee

Hi @0xEC ,

One way by which you use those commands using a system call from the c Program.

system(command(GPIO Set Command)).

 

2,450 Views
0xEC
Contributor IV
Ok @MayanksPatel thank you,
Best,
0 Kudos
Reply