2

We recently bought two Raspberry Pi 3 B from Cana Kit. We observed that some of the GPIO pins are not functioning properly. More specific details below.

We tried to change the state of GPIO pin 7 to 1 (or True). But it stays at level 0 (or False). Specific python commands as follows:

import RPi.GPIO as gp
gp.setup(gp.BOARD)
gp.setmode(7, gp.OUT)
gp.output(7, True)
gp.input(7)

Line 4 should have set pin 7 to level 1, but line 5 outputs 0.

We observed this in the first Raspberry Pi 3 that we bought, thought it could be a faulty board and purchased a second Raspberry Pi 3 from you. But both boards are behaving the same way. Could you please help us ?

When I change a state of 11 and 12, they successfully change. However, pin 7 does not change. Please see the result

When I change a state of 11 and 12, they successfully change. However, pin 7 does not change. Please see the result:

  • 1
    I don't think you can call input on a pin that's marked for output. – Brick Aug 1 '17 at 20:24
  • when I use input for pin 11 and 12, it works and can change them to 1. – Hanieh Aug 1 '17 at 20:31
  • 1
    Did you try measuring the voltage on the pins themselves? I'd bet you have 3.3 V on Pin 7, after setting it high, no matter what you get back from the software. – Brick Aug 1 '17 at 21:41
  • A GPIO will remain at the last set value until you set a new value (using the output function in your case). I just mention that as you can't be sure of the value returned by input until you have called output. Doesn't help here but may confuse the issue later. The most likely "problem" is you have the 1-wire bus enabled which defaults to GPIO4 (pin 7). Check /boot/config.txt and comment out any entry starting w1 and reboot. – joan Aug 2 '17 at 10:00
  • The problem was solved through commenting "dtoverlay=w1-gpio" It changes to "1" now. Thank you for your help @joan. I'm so interested to learn more, hence, was wondering if you could give me more detail about each comment on "config.txt" – Hanieh Aug 2 '17 at 19:23
0

A GPIO will remain at the last set value until you set a new value (using the output function in your case). I just mention that as you can't be sure of the value returned by input until you have called output. Doesn't help here but may confuse the issue later.

The most likely "problem" is you have the 1-wire bus enabled which defaults to GPIO4 (pin 7). Check /boot/config.txt and comment out any entry starting w1 and reboot.

The problem was solved through commenting "dtoverlay=w1-gpio" It changes to "1" now.


From comments: GPIO is not working and GPIO is not working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.