S32G274A-RDB2 board yocto image GPIO set error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32G274A-RDB2 board yocto image GPIO set error

跳至解决方案
2,489 次查看
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, 

 

 

标记 (3)
0 项奖励
回复
1 解答
2,463 次查看
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

在原帖中查看解决方案

5 回复数
1,966 次查看
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 项奖励
回复
2,464 次查看
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,457 次查看
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 项奖励
回复
2,454 次查看
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,449 次查看
0xEC
Contributor IV
Ok @MayanksPatel thank you,
Best,
0 项奖励
回复