GPIO issue on NanosG20 board
I have a nanosG20 with a bunch of GPIO pins.
After 'exporting' en setting the 'direction' and 'value' of the GPIO pins the voltage on the pins will not change when I change the 'value'
pin 2 = PB17
echo 81 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio81/direction
echo 0(or 1) > /sys/class/gpio/gpio81/value
The voltage remains 3.3V. Adding a pull-down resistor of 10k does not help.
Also, according to the manual pin 12 should be 5V, I only measure 3.3V on that pin.
What am I doing wrong??
I do not want to be a dick, but why do this post has over 100 views and not one reply?
I'm not an experienced programmer nor a electronics wizzard and I just need a tip or some advice...
Any help would be appreciated.
It's because your question is very target specific. Only someone with first-hand experience with your board is likely to be able to give a qualified response. Also, your sample code includes no comments and is probably meaningless to most people. What does
I'm not trying to be a dick, either. Just trying to point out how you can help yourself.
thx for your reply theNbomr!
On AT91SAM9G20 three gpiochips are available in /sys/class/gpio. These chips correspond to PIOA (/sys/class/gpio/gpiochip32), PIOB (/sys/class/gpio/gpiochip64) and PIOC (/sys/class/gpio/gpiochip96) each covering 32 GPIOs.
On this board I have a connector containing 26 GPIO pins.
pin 2 on this connector represents address(?) (B)17 of gpiochip64, which makes 81 (17+64).
To transfer the gpio-pin to userspace and connect it to my hardware I have to 'export' it and set its 'direction' and 'value'.
I have tried all types of pull-ups/down, but I can't get the output to change it 'physical'
So I'm stuck...bigtime!
Okay, so I found Use GPIO pins from userspace, where it does describe what you're doing, and everything looks right according to that description. It would have been helpful for you to post a link to that page, but I see that your low post-count would probably prohibit that.
Have you tried another IO bit? Are you sure you are actually measuring the correct pin? Pins on a pin-header are usually numbered from pin 1 at one corner with the odd numbered pins on one row, and the even numbered pins on the other row. Many people start counting from pin 1, and assume the rest of the pins on the same row are numbered in sequence 2, 3, 4,...
It doesn't say so, but you may need root privileges to do what you're trying. Do you have that? I didn't dig into the type of output on the pins, but a common style is an open-drain, which requires a pullup for the bit to go high, and the chip pulls it low when a 0 is written.
The doc's say you supply 5VDC to the board but an on-board regulator drops this to the 3.3V required by the logic family of the chip(s) on the board.
When I'm trying to track down a pin's behavior, I sometimes like to create a loop that toggles the bit periodically:
thx very much for your time and advice!
I will test it again with the pull-up, I already did it but I will test it again in combination with your sample code.:)
I will post the result later!
Just looked at it again, and some pins work and others do not. I just need to figure out why.
Thx again for your help.
|All times are GMT -5. The time now is 05:16 AM.|