全志R58平台的GPIO引脚控制
全志R58平台的GPIO引脚控制
2017/8/18 15:50
版本:V1.0
开发板:SC5806(全志R58平台)
SDK:android4.4.4
本文以GPIO引脚PD24为例,在开发板的背面。J18座子上,+5V旁边(可以用这个引脚来定位!)。
rootroot@cm-System-Product-Name:/home/wwt/vxiaoyu_s5k5eya/lichee/linux-3.4$ make ARCH=arm menuconfig
Device Drivers --->
-*- GPIO Support --->
[ ] /sys/class/gpio/... (sysfs interface)
修改为:
[*] /sys/class/gpio/... (sysfs interface)
rootroot@cm-System-Product-Name:/home/wwt/vxiaoyu_s5k5eya/lichee$ find . -name gpio.h
./linux-3.4/arch/arm/mach-sunxi/include/mach/gpio.h
W:\xiaoyu_s5k5eya\lichee\linux-3.4\arch\arm\mach-sunxi\include\mach\gpio.h
得知GPIO号:
#define SUNXI_PINCTRL "sunxi-pinctrl"
#define SUNXI_BANK_SIZE 32
#define SUNXI_PA_BASE 0
#define SUNXI_PB_BASE 32
#define SUNXI_PC_BASE 64
#define SUNXI_PD_BASE 96
#define SUNXI_PE_BASE 128
#define SUNXI_PF_BASE 160
#define SUNXI_PG_BASE 192
#define SUNXI_PH_BASE 224
#define SUNXI_PI_BASE 256
#define SUNXI_PJ_BASE 288
#define SUNXI_PK_BASE 320
#define SUNXI_PL_BASE 352
#define SUNXI_PM_BASE 384
#define SUNXI_PN_BASE 416
#define SUNXI_PO_BASE 448
#define AXP_PIN_BASE 1024
PD24的GPIO引脚号为:
96+24=120
在串口终端中的调试方法:
shell@octopus-f1:/ $
shell@octopus-f1:/ $ cd /sys/class/gpio/
shell@octopus-f1:/sys/class/gpio $ ll
--w------- root root 4096 1970-01-01 09:01 export
lrwxrwxrwx root root 1970-01-01 09:01 gpiochip0 -> ../../devices/platform/sunxi-pinctrl/gpio/gpiochip0
lrwxrwxrwx root root 1970-01-01 09:01 gpiochip1024 -> ../../devices/platform/axp-pinctrl/gpio/gpiochip1024
--w------- root root 4096 1970-01-01 09:01 unexport
shell@octopus-f1:/sys/class/gpio $
shell@octopus-f1:/sys/class/gpio $
(必须su权限:)
shell@octopus-sc5806:/sys/class/gpio $
shell@octopus-sc5806:/sys/class/gpio $ echo 120 > export
/system/bin/sh: can't create export: Permission denied
1|shell@octopus-sc5806:/sys/class/gpio $
1|shell@octopus-sc5806:/sys/class/gpio $ su
shell@octopus-sc5806:/sys/class/gpio #
shell@octopus-sc5806:/sys/class/gpio #
shell@octopus-sc5806:/sys/class/gpio # echo 120 > export
shell@octopus-sc5806:/sys/class/gpio # ll
--w------- root root 4096 1970-01-02 09:13 export
lrwxrwxrwx root root 1970-01-02 09:13 gpio120 -> ../../devices/platform/sunxi-pinctrl/gpio/gpio120
lrwxrwxrwx root root 1970-01-02 09:11 gpiochip0 -> ../../devices/platform/sunxi-pinctrl/gpio/gpiochip0
lrwxrwxrwx root root 1970-01-02 09:11 gpiochip1024 -> ../../devices/platform/axp-pinctrl/gpio/gpiochip1024
--w------- root root 4096 1970-01-02 09:11 unexport
shell@octopus-sc5806:/sys/class/gpio #
切换到DP24的目录:
shell@octopus-sc5806:/sys/class/gpio # cd gpio120/
shell@octopus-sc5806:/sys/class/gpio/gpio120 # ll
-rw-r--r-- root root 4096 1970-01-02 09:14 active_low
lrwxrwxrwx root root 1970-01-02 09:14 device -> ../../../sunxi-pinctrl
-rw-r--r-- root root 4096 1970-01-02 09:14 direction
drwxr-xr-x root root 1970-01-02 09:14 power
lrwxrwxrwx root root 1970-01-02 09:14 subsystem -> ../../../../../class/gpio
-rw-r--r-- root root 4096 1970-01-02 09:14 uevent
-rw-r--r-- root root 4096 1970-01-02 09:14 value
shell@octopus-sc5806:/sys/class/gpio/gpio120 #
shell@octopus-sc5806:/sys/class/gpio/gpio120 # cat direction
in
shell@octopus-sc5806:/sys/class/gpio/gpio120 # echo out > direction
shell@octopus-sc5806:/sys/class/gpio/gpio120 #
shell@octopus-sc5806:/sys/class/gpio/gpio120 #
shell@octopus-sc5806:/sys/class/gpio/gpio120 # cat direction
out
shell@octopus-sc5806:/sys/class/gpio/gpio120 #
shell@octopus-sc5806:/sys/class/gpio/gpio120 #
shell@octopus-sc5806:/sys/class/gpio/gpio120 # cat value
0
shell@octopus-sc5806:/sys/class/gpio/gpio120 #
shell@octopus-sc5806:/sys/class/gpio/gpio120 # echo 1 > value
shell@octopus-sc5806:/sys/class/gpio/gpio120 #
shell@octopus-sc5806:/sys/class/gpio/gpio120 # cat value
1
shell@octopus-sc5806:/sys/class/gpio/gpio120 #
万用表测得DP24为2.974V(高)
shell@octopus-sc5806:/sys/class/gpio/gpio120 # cat value
1
shell@octopus-sc5806:/sys/class/gpio/gpio120 # echo 0 > value
shell@octopus-sc5806:/sys/class/gpio/gpio120 # cat value
0
shell@octopus-sc5806:/sys/class/gpio/gpio120 #
万用表测得DP24为0.000V(低)
全志R58平台的GPIO引脚控制的更多相关文章
- 31全志r58平台Android4.4.2下打开USB摄像头
31全志r58平台Android4.4.2下打开USB摄像头 2018/10/26 16:00 版本:V1.0 开发板:SC5806 1.系统编译:(略) 2.需要修改的文件: W:\r58_andr ...
- 02全志r58平台Android4.4.4下关闭内核中的CPU的开启关闭提示
02全志r58平台Android4.4.4下关闭内核中的CPU的开启关闭提示 2017/8/18 13:53 版本:V1.0 开发板:SC5806(全志R58平台) SDK:android4.4.4 ...
- 51全志R58平台Android4.4下Camera的HAL层修改
51全志R58平台Android4.4下Camera的HAL层修改 2018/11/7 15:20 版本:V1.0 开发板:SC5806 1.系统编译: (略) 2.全志R58平台Android4.4 ...
- 04全志R58平台编译内核需要选择的配置
04全志R58平台编译内核需要选择的配置 2018/11/6 14:19 版本:V1.0 开发板:SC5806 1.系统编译:(略) 每次系统编译/内核的时候都需要选3次N: * * Xtables ...
- 全志R58平台调通s5k5eya(RAW+MIPI)
全志R58平台调通s5k5eya(RAW+MIPI) 2017/5/31 10:30 版本:V1.1 1.前期使用的是s5k5eyx的ISP的固件/tuning 文件 Y:\s5k5eya_r58_d ...
- GPIO引脚操作
Kernel: 4.4 Soc: msm8996 1.用户空间通过sysfs操作GPIO (1)启用GPIO sysfs interface 首先看系统中有没有“/sys/class/gpio”这个文 ...
- linux下对/sys/class/gpio中的gpio的控制 (转)
在嵌入式设备中对GPIO的操作是最基本的操作.一般的做法是写一个单独驱动程序,网上大多数的例子都是这样的.其实linux下面有一个通用的GPIO操作接口,那就是我要介绍的 “/sys/clas ...
- 21全志r58m平台的framework在使用过程中会莫名的崩溃掉
21全志r58m平台的framework在使用过程中会莫名的崩溃掉 2018/10/25 16:20 版本:V1.0 开发板:SC5806 1.系统编译: rootroot@cm88:/home/ww ...
- 461在全志r16平台tinav3.0系统下使用地磁计QMC5883L
461在全志r16平台tinav3.0系统下使用地磁计QMC5883L 2018/9/7 14:08 版本:V1.0 开发板:SC3817R SDK:tina v3.0 (基本确认全志tina v3. ...
随机推荐
- React 编码
https://github.com/Minwe/style-guide/blob/master/React.js.md https://github.com/planningcenter/react ...
- ie的兼容方法,条件注释的方法
1.终极方法:条件注释 <!--[if lte IE 6]> 这段文字仅显示在 IE6及IE6以下版本. <![endif]--> <!--[if gte IE 6]&g ...
- hihocoder hiho一下 第二十六周 最小生成树一·(Prim算法)
题目1 : 最小生成树一·Prim算法 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 最近,小Hi很喜欢玩的一款游戏模拟城市开放出了新Mod,在这个Mod中,玩家可以拥 ...
- VC++读写文件
目录 第1章读写文件 1 1.1 API 1 1.2 低级IO 1 1.2.1 文件序号 1 1.2.2 文本文件与二进制文件 1 1.3 流IO 2 1.4 Un ...
- bzoj4516
后缀自动机 留个板子 upd:大概懂了 每次新加入的npRight集合肯定只有最后一个位置,那么求所有长得不一样的子串贡献就是Max-Min+1,因为Right集合只有这一个位置,所以这Max-Min ...
- python学习笔记7-异常处理
1 写弄成了读 1 try: fh = open("testfile", "r") fh.write("This is my test file fo ...
- ecb-2.40与cedet-1.1的兼容(转载)
转自:http://blog.csdn.net/cnsword/article/details/7474119 今天凑热闹把fedora升级到了17,emacs升级到了24,但是悲剧了,显示cedet ...
- eclipse导入工程报Invalid project description(转载)
转自:http://blog.sina.com.cn/s/blog_a2eab3000101k3r7.html 昨天新搭建的环境,今天把以前的项目导入eclipse时报错: 说的是我导入的项目与wor ...
- Golang 读写锁RWMutex 互斥锁Mutex 源码详解
前言 Golang中有两种类型的锁,Mutex (互斥锁)和RWMutex(读写锁)对于这两种锁的使用这里就不多说了,本文主要侧重于从源码的角度分析这两种锁的具体实现. 引子问题 我一般喜欢带着问题去 ...
- fzu2280 Magic(暴力+哈希预处理)
传送门 题意 q次操作,每次两种操作: 1 x y:将wx变成y 2 x:查询满足一下两个条件的字符串(①以字符串x为后缀②字符串值\(\le wx\)) 分析 对n个字符串预处理,设f[i][j]为 ...