iomari Posted July 30, 2019 Share Posted July 30, 2019 Greetings, After setting my tinkerboard pins 22 and 24 as an Inputs, they reverts to being an output pin on HIgh after around 30 seconds. What is the cause of this? Is this some kind of feature. I don't have this happen on any other pin other than these 2. iomari Link to comment Share on other sites More sharing options...
iomari Posted September 23, 2019 Author Share Posted September 23, 2019 anyone? please? Link to comment Share on other sites More sharing options...
martinayotte Posted September 23, 2019 Share Posted September 23, 2019 35 minutes ago, iomari said: anyone? please? What "cat /sys/kernel/debug/gpio" is reporting ? Are those pins already "in-use" by some other drivers ? Link to comment Share on other sites More sharing options...
iomari Posted September 24, 2019 Author Share Posted September 24, 2019 see attachment. t Link to comment Share on other sites More sharing options...
martinayotte Posted September 24, 2019 Share Posted September 24, 2019 2 hours ago, iomari said: see attachment. They are not "in-use" by any process... So, try using them thru "sysfs" and then check again /sys/kernel/debug/gpio every 30 secs : echo 22 > /sys/class/gpio/export echo 24 > /sys/class/gpio/export echo in > /sys/class/gpio/gpio22/direction echo in > /sys/class/gpio/gpio24/direction Link to comment Share on other sites More sharing options...
iomari Posted September 24, 2019 Author Share Posted September 24, 2019 Thanks for your reply. I work primarily from python. But I ran the commands you suggested: # sudo echo 22 > /sys/class/gpio/export # -bash: /sys/class/gpio/export: Permission denied # sudo echo in > /sys/class/gpio/gpio22/direction # -bash: /sys/class/gpio/gpio22/direction: No such file or directory Link to comment Share on other sites More sharing options...
martinayotte Posted September 24, 2019 Share Posted September 24, 2019 34 minutes ago, iomari said: -bash: /sys/class/gpio/export: Permission denied "sudo" doesn't work in such redirection, it is apply only on left part which is "echo" only. Try login as root first, then try again, or do it this way : sudo su - -c "echo 22 > /sys/class/gpio/export" sudo su - -c "echo in > /sys/class/gpio/gpio22/direction" Link to comment Share on other sites More sharing options...
iomari Posted September 25, 2019 Author Share Posted September 25, 2019 same problem: # sudo su -c echo in > /sys/class/gpio/gpio/export # -bash: /sys/class/gpio/gpio/export: No such file or directory # sudo su -c echo in > /sys/class/gpio/gpio/gpio22/direction -bash: /sys/class/gpio/gpio/gpio22/direction: No such file or directory as root: root@TK-03:~# echo in > /sys/class/gpio/gpio/export -su: /sys/class/gpio/gpio/export: No such file or directory root@TK-03:~# echo in > /sys/class/gpio/gpio22/direction -su: /sys/class/gpio/gpio22/direction: No such file or directory root@TK-03:~# Link to comment Share on other sites More sharing options...
martinayotte Posted September 25, 2019 Share Posted September 25, 2019 3 hours ago, iomari said: same problem: You've mistakenly changed the path I've provided by adding "gpio" twice ... Again : sudo su - -c "echo 22 > /sys/class/gpio/export" sudo su - -c "echo in > /sys/class/gpio/gpio22/direction" Link to comment Share on other sites More sharing options...
iomari Posted September 25, 2019 Author Share Posted September 25, 2019 thanks. sco@TK-03:/$sudo su - -c "echo 24 > /sys/class/gpio/export" sco@TK-03:/$ sudo su - -c "echo in > /sys/class/gpio/gpio24/direction" -su: line 0: echo: write error: Invalid argument sco@TK-03:/$ sudo su - -c "echo 26 > /sys/class/gpio/export" sco@TK-03:/$ sudo su - -c "echo in > /sys/class/gpio/gpio26/direction" -su: line 0: echo: write error: Invalid argument sco@TK-03:/$ su -l Password: root@TK-03:~# echo 'in' > /sys/class/gpio/gpio26/direction -su: echo: write error: Invalid argument root@TK-03:~# ls -la /sys/class/gpio/gpio26/ total 0 drwxr-xr-x 3 root root 0 Sep 25 14:02 . drwxr-xr-x 38 root root 0 Sep 25 14:02 .. -rw-r--r-- 1 root root 4096 Sep 25 14:02 active_low lrwxrwxrwx 1 root root 0 Sep 25 14:02 device -> ../../../pinctrl -rw-r--r-- 1 root root 4096 Sep 25 14:16 direction -rw-r--r-- 1 root root 4096 Sep 25 14:02 edge drwxr-xr-x 2 root root 0 Sep 25 14:02 power lrwxrwxrwx 1 root root 0 Sep 25 14:02 subsystem -> ../../../../../class/gpio -rw-r--r-- 1 root root 4096 Sep 25 14:02 uevent -rw-r--r-- 1 root root 4096 Sep 25 14:02 value export works, 2nd line doesn't Link to comment Share on other sites More sharing options...
martinayotte Posted September 25, 2019 Share Posted September 25, 2019 2 hours ago, iomari said: export works, 2nd line doesn't Is the SPI enabled in DT ? it seems that those pins are maybe shared ... Link to comment Share on other sites More sharing options...
iomari Posted September 25, 2019 Author Share Posted September 25, 2019 3 minutes ago, martinayotte said: Is the SPI enabled in DT ? it seems that those pins are maybe shared ... I don't understand. Link to comment Share on other sites More sharing options...
Recommended Posts