sama5d3 环境检测 gpio--yk测试

说明: 

gpio的MAP关系 yk0--pioA7  yk1--pioA5   yk2--pioA9   yk3--pioA3   yk4--pioA1  yk5--pioA8    (端子从左-->右 QD--pioA21内部总启动信号)

1 配置gpio:

root@sama5d3-linux:~ echo 8 > /sys/class/gpio/export                            
root@sama5d3-linux:~ echo 1 > /sys/class/gpio/export                            
root@sama5d3-linux:~ echo 3 > /sys/class/gpio/export                            
root@sama5d3-linux:~ echo 9 > /sys/class/gpio/export                            
root@sama5d3-linux:~ echo 5 > /sys/class/gpio/export                            
root@sama5d3-linux:~ echo 7 > /sys/class/gpio/export

2 配置GPIO方向:

root@sama5d3-linux:~ echo out > /sys/class/gpio/pioA8/direction                 
root@sama5d3-linux:~ echo out > /sys/class/gpio/pioA1/direction                 
root@sama5d3-linux:~ echo out > /sys/class/gpio/pioA3/direction                 
root@sama5d3-linux:~ echo out > /sys/class/gpio/pioA9/direction                 
root@sama5d3-linux:~ echo out > /sys/class/gpio/pioA5/direction                 
root@sama5d3-linux:~ echo out > /sys/class/gpio/pioA7/direction

 

3 配置GPIO初始化电平(继电器全部关断): 

root@sama5d3-linux:~ echo 1 > /sys/class/gpio/pioA8/value                       
root@sama5d3-linux:~ echo 1 > /sys/class/gpio/pioA1/value                       
root@sama5d3-linux:~ echo 1 > /sys/class/gpio/pioA3/value                       
root@sama5d3-linux:~ echo 1 > /sys/class/gpio/pioA9/value                       
root@sama5d3-linux:~ echo 1 > /sys/class/gpio/pioA5/value                       
root@sama5d3-linux:~ echo 1 > /sys/class/gpio/pioA7/value

 

4 配置QD((继电器电源关断)):  

root@sama5d3-linux:~ echo 21 > /sys/class/gpio/export                           
root@sama5d3-linux:~ echo out > /sys/class/gpio/pioA21/direction                
root@sama5d3-linux:~ echo 1 > /sys/class/gpio/pioA21/value

 

5 驱动继电器闭合((条件首先QD要闭合)): 

root@sama5d3-linux: echo 0 > /sys/class/gpio/pioA21/value

root@sama5d3-linux: echo 0 > /sys/class/gpio/pioA8/value //yk0合

root@sama5d3-linux: echo 1 > /sys/class/gpio/pioA8/value //yk0 关

root@sama5d3-linux: echo 0 > /sys/class/gpio/pioA1/value //yk1合

root@sama5d3-linux: echo 1 > /sys/class/gpio/pioA1/value //yk1关

 

                

posted on 2015-10-09 10:57  嵌入式操作系统  阅读(350)  评论(0编辑  收藏  举报

导航