Firefly Open Source Community

Title: i need help to identify the relay gpio [Print This Page]

Author: melop    Time: 6/19/2020 01:07
Title: i need help to identify the relay gpio
hey there everyone , totaly new here.

i received not long ago a rockhip chines dev board , it came with android installed on it, and some devices attached to it , leds,sensors,thermal sensor, camera ,relay and more.   most of them are connected via gpio  , some usb on the board



this is a IOT-3288X



since most the devices are connected via gpios is that  the weird part for example are the gpio names,  for example there is a led connected to multiple place on the board 1 led 3 colors , they are all under gpio_sw in /sys/class/gpio_sw/ .  so instead of having a normal such as LEDWHITE it has totaly different names for example to turn on the white led  i have to

"echo 1 > /sys/devices/platform/rk3288-extern-gpio/gpio_sw/WIFI_PW/data"

which make no sense, but i guess everything is messed up



so right now i am trying to understand which gpio is turning on a relay gate ,

i did checked the hardware pins on a chines manual  and it seems that the relay is connected to pin 19 and 20 , however  when i exported the pins to the /sys/class/gpio/export  and then tried to changed the value of it, it did not work.  i am at a stage that i am sitting on it for over 16h straight trying to figuring this out without any success

note that i even exported all 264 pins , and tried to change all of them to direction out , however the device crashed and restart , i tried to minimized it to 100 (batch of 100) than minimzed to 10, it carshed all the way, i tried also to change all the values to 1 (without the direction out, so gpio that are on out should've work) it did no changes , i tried to set the value to 0 (on all pins) nothing happen aswell.



when exporting the all the pins , some did not work (all the gpios pins in sys/kernel/debug/gpio could not be exported inside the gpio folder im not sure why , pehaps they are being used or already open/mounted? so how do i use them)



there is an app on the android , which allow me to change the relay more (normaly open, normaly close) (perhaps that can help idk)



any of u have an idea how can i determine what the app is controlling ?

of figuring out what gpio is that  so i can turn on and off the relay on my command/demand  ?





  1. cat /sys/kernel/debug/gpio

  2. GPIOs 0-23, platform/pinctrl, gpio0:

  3. gpio-1   (                    |reset               ) out hi

  4. gpio-3   (                    |rk3288 gpio         ) out hi

  5. gpio-5   (                    |power               ) in  hi

  6. gpio-11  (                    |rk3288 gpio         ) out lo

  7. gpio-12  (                    |otg_drv_gpio        ) out hi

  8. gpio-13  (                    |rk3288 gpio         ) out lo

  9. gpio-14  (                    |vcc_host            ) out hi

  10. gpio-17  (                    |rk3288 gpio         ) out hi

  11. gpio-18  (                    |rk3288 gpio         ) out lo



  12. GPIOs 24-55, platform/pinctrl, gpio1:



  13. GPIOs 56-87, platform/pinctrl, gpio2:



  14. GPIOs 88-119, platform/pinctrl, gpio3:



  15. GPIOs 120-151, platform/pinctrl, gpio4:

  16. gpio-127 (                    |mdio-reset          ) out hi

  17. gpio-139 (                    |bt_default_rts      ) out lo

  18. gpio-146 (                    |bt_default_wake     ) out hi

  19. gpio-148 (                    |reset               ) out hi

  20. gpio-149 (                    |bt_default_reset    ) out hi

  21. gpio-151 (                    |bt_default_wake_host) out hi



  22. GPIOs 152-183, platform/pinctrl, gpio5:

  23. gpio-162 (                    |wiegand_d1          ) in  hi

  24. gpio-163 (                    |wiegand_d0          ) in  hi



  25. GPIOs 184-215, platform/pinctrl, gpio6:



  26. GPIOs 216-247, platform/pinctrl, gpio7:

  27. gpio-218 (                    |rk3288 gpio         ) out lo

  28. gpio-219 (                    |vcc_lcd             ) out lo

  29. gpio-220 (                    |rk3288 gpio         ) out hi

  30. gpio-221 (                    |rk3288 gpio         ) out lo

  31. gpio-222 (                    |rk3288 gpio         ) out hi

  32. gpio-225 (                    |vcc_wl              ) out lo

  33. gpio-226 (                    |rk3288 gpio         ) out hi

  34. gpio-228 (                    |rk3288 gpio         ) out hi

  35. gpio-229 (                    |rk3288 gpio         ) out lo

  36. gpio-230 (                    |enable              ) out hi

  37. gpio-231 (                    |headset_gpio        ) in  lo

  38. gpio-237 (                    |rk3288 gpio         ) out hi



  39. GPIOs 248-263, platform/pinctrl, gpio8:

  40. gpio-248 (                    |mpu6500             ) in  lo

  41. gpio-249 (                    |rk3288 gpio         ) out hi

  42. gpio-250 (                    |recovey             ) in  hi

  43. gpio-251 (                    |rk3288 gpio         ) out lo

  44. gpio-257 (                    |enable              ) out hi
Copy the code







  1. cat /sys/kernel/debug/pinctrl/pinctrl/gpio-ranges

  2. GPIO ranges handled:

  3. 0: gpio0 GPIOS [0 - 23] PINS [0 - 23]

  4. 1: gpio1 GPIOS [24 - 55] PINS [24 - 55]

  5. 2: gpio2 GPIOS [56 - 87] PINS [56 - 87]

  6. 3: gpio3 GPIOS [88 - 119] PINS [88 - 119]

  7. 4: gpio4 GPIOS [120 - 151] PINS [120 - 151]

  8. 5: gpio5 GPIOS [152 - 183] PINS [152 - 183]

  9. 6: gpio6 GPIOS [184 - 215] PINS [184 - 215]

  10. 7: gpio7 GPIOS [216 - 247] PINS [216 - 247]

  11. 8: gpio8 GPIOS [248 - 263] PINS [248 - 263]
Copy the code





  1. ls -lha /sys/class/gpio/

  2. gpiochip0 -> ../../devices/platform/pinctrl/gpio/gpiochip0

  3. gpiochip120 -> ../../devices/platform/pinctrl/gpio/gpiochip120

  4. gpiochip152 -> ../../devices/platform/pinctrl/gpio/gpiochip152

  5. gpiochip184 -> ../../devices/platform/pinctrl/gpio/gpiochip184

  6. gpiochip216 -> ../../devices/platform/pinctrl/gpio/gpiochip216

  7. gpiochip24 -> ../../devices/platform/pinctrl/gpio/gpiochip24

  8. gpiochip248 -> ../../devices/platform/pinctrl/gpio/gpiochip248

  9. gpiochip56 -> ../../devices/platform/pinctrl/gpio/gpiochip56

  10. gpiochip88 -> ../../devices/platform/pinctrl/gpio/gpiochip88
Copy the code








(P.S, there is also a thermal sensor , that speaks via i2c, which again idk on what gpio is that so i can perhaps start to communicate with it)



any how thanks for the help , and please ask me anything ! , so i can try to help myself here.

i know maybe it seems abit non organized  but i am after 20h of being awake



maybe phrase it differently would be



i want to figure out which path in /sys/... corresponds to which GPIO pin that is connected.



please guide me .



Thanks




Welcome Firefly Open Source Community (https://bbs.t-firefly.com/) Powered by Discuz! X3.1