Intel Edison Board GPIO Control 모든 핀을 세팅하기 전에 pin 214 LOW 해주고 나중에 HIGH 해야함 살펴보기 root@edison_kjc:~# ls /sys/class/gpio export gpio182 gpio215 gpio233 gpio255 gpio45 gpio12 gpio183 gpio216 gpio234 gpio256 gpio46 gpio124 gpio200 gpio217 gpio235 gpio257 gpio47 gpio125 gpio201 gpio218 gpio236 gpio258 gpio48 gpio126 gpio202 gpio219 gpio237 gpio259 gpio49 gpio127 gpio203 gpio220 gpio240 gpio260 gpiochip0 gpio128 gpio204 gpio221 gpio241 gpio261 gpiochip200 gpio129 gpio205 gpio222 gpio242 gpio262 gpiochip216 gpio13 gpio207 gpio223 gpio243 gpio263 gpiochip232 gpio130 gpio208 gpio224 gpio248 gpio27 gpiochip248 gpio131 gpio209 gpio225 gpio249 gpio28 unexport gpio132 gpio210 gpio226 gpio250 gpio40 gpio133 gpio211 gpio227 gpio251 gpio41 gpio134 gpio212 gpio228 gpio252 gpio42 gpio14 gpio213 gpio229 gpio253 gpio43 gpio165 gpio214 gpio232 gpio254 gpio44 root@edison_kjc:~# IO 0 ~13 Digital PIN이며 digital 13핀은 40번으로 리눅스가 알아들음 root@edison_kjc:~# ls -l /sys/class/gpio/gpio40/ -rw-r--r-- 1 root root 4096 Mar 7 06:55 active_low lrwxrwxrwx 1 root root 0 Mar 7 06:55 device -> ../../../0000:00:0c.0 -rw-r--r-- 1 root root 4096 Mar 7 06:17 direction -rw-r--r-- 1 root root 4096 Mar 7 06:55 edge drwxr-xr-x 2 root root 0 Mar 7 06:55 power lrwxrwxrwx 1 root root 0 Mar 7 06:55 subsystem -> ../../../../../class/gpio -rw-r--r-- 1 root root 4096 Mar 7 06:17 uevent -rw-r--r-- 1 root root 4096 Mar 7 06:17 value root@edison_kjc:~# echo out > /sys/class/gpio/gpio40/direction -> gpio 40을 out으로 설정 root@edison_kjc:~# echo 1 > /sys/class/gpio/gpio40/value -> gpio 40에 HIGH(1) 설정 그러나 13핀에 연결된 LED 켜지지는 않음 40번을 포트 설정 root@edison_kjc:~# echo 40 > /sys/class/gpio/unexport root@edison_kjc:~# echo 40 > /sys/class/gpio/export root@edison_kjc:~# 261번을 포트설정 root@edison_kjc:~# echo 261 > /sys/class/gpio/unexport root@edison_kjc:~# echo 261 > /sys/class/gpio/export 214에 LOW값 세팅 root@edison_kjc:~# echo low > /sys/class//gpio/gpio214/direction 261번을 high 해야 한다. root@edison_kjc:~# echo high > /sys/class//gpio/gpio261/direction SoC pin mode 변경해야함 0으로 root@edison_kjc:~# echo mode0 > /sys/kernel/debug/gpio_debug/gpio40/current_pinmux root@edison_kjc:~# echo out > /sys/class/gpio/gpio40/direction 40번을 high로 세팅 root@edison_kjc:~# echo 1 > /sys/class/gpio/gpio40/value 214에 HIGH 값 세팅 root@edison_kjc:~# echo high > /sys/class/gpio/gpio214/direction 처리할 것이 없는 7번으로 다시 설정해본다 IO7 -> 48(Linux GPIO pin) root@edison_kjc:~# ls /sys/class/gpio/gpio48/ active_low device direction edge power subsystem uevent value root@edison_kjc:~# echo 48 > /sys/class/gpio/export -> 48포트를 사용할 것이다. -sh: echo: write error: Device or resource busy root@edison_kjc:~# echo 48 > /sys/class/gpio/unexport -> 48포트를 해제. root@edison_kjc:~# ls /sys/class/gpio/ export gpio133 gpio207 gpio219 gpio233 gpio251 gpio263 gpiochip0 gpio12 gpio134 gpio208 gpio220 gpio234 gpio252 gpio27 gpiochip200 gpio124 gpio14 gpio209 gpio221 gpio235 gpio253 gpio28 gpiochip216 gpio125 gpio165 gpio210 gpio222 gpio236 gpio254 gpio40 gpiochip232 gpio126 gpio182 gpio211 gpio223 gpio237 gpio255 gpio41 gpiochip248 gpio127 gpio183 gpio212 gpio224 gpio240 gpio256 gpio42 unexport gpio128 gpio200 gpio213 gpio225 gpio241 gpio257 gpio43 gpio129 gpio201 gpio214 gpio226 gpio242 gpio258 gpio44 gpio13 gpio202 gpio215 gpio227 gpio243 gpio259 gpio45 gpio130 gpio203 gpio216 gpio228 gpio248 gpio260 gpio46 gpio131 gpio204 gpio217 gpio229 gpio249 gpio261 gpio47 gpio132 gpio205 gpio218 gpio232 gpio250 gpio262 gpio49 48 포트가 사라짐 root@edison_kjc:~# echo 48 > /sys/class/gpio/export 다시 실행 root@edison_kjc:~# echo out > /sys/class/gpio/gpio48/direction root@edison_kjc:~# echo 1 > /sys/class/gpio/gpio48/value LED를 키기 위해 output enable 255를 설정해야 함 root@edison_kjc:~# echo 1 > /sys/class/gpio/gpio255/value -> LED 불이 들어온다. root@edison_kjc:~# echo 0 > /sys/class/gpio/gpio255/value -> LED 불이 꺼진다.GPIO
'사물인터넷' 카테고리의 다른 글
Intel Edison Board IoT mraa API 사용 (0) | 2016.03.08 |
---|---|
Intel Edison Board IoT Eclipse (0) | 2016.03.08 |
Intel Edison board 시작 (2) | 2016.03.08 |
사물 인터넷 기기 실습 - API 설계 실습 (0) | 2016.02.11 |
Express와 Postman을 이용한 개방형 API 실습 (0) | 2016.02.11 |