Open jonturner53 opened 7 years ago
Followup to my post. I have just discovered that while the pins file is not correct, it appears that the exported configuration in /sys/class/gpio is correct. In particular, the value of /sys/class/gpio/gpio_20/direction is "in", even though the pins file shows that signal as an output. ARGH!!!
So, it now appears that the bug may actually be in the Linux kernel. Or perhaps I am mistaken my understanding of the pins file.
If anyone out there understands what's going on, please enlighten me.
Hit the wrong button. This issue is not closed.
It appears that in some cases, the order of pinMode calls affects the pin configuration. For example, a test program containing the following two lines
pinMode(GPIO0_2, OUTPUT, 0) pinMode(GPIO0_20, INPUT, 0)
works as expected. Specifically, in the pins file we find
pin 84 (44e10950) 00000007 pinctrl-single pin 109 (44e109b4) 0000002f pinctrl-single
pin number 84 corresponds to GPIO0_2 and 109 corresponds to GPIO0_20. However, if you reverse the order of the two pinMode calls, you get
pin 84 (44e10950) 00000007 pinctrl-single pin 109 (44e109b4) 00000007 pinctrl-single
That is, both signals are configured as outputs.