2

I'm using a Raspberry Pi 3 Model B running Raspbian Stretch

Using it somewhat like an RC car with an L298N H-bridge motor driver to control two DC motors.

It was working fine until a few days ago but now for some reason it isn't working. After checking I have found that the GPIO pins are always set at 0V.

Here's the code I'm using :

import time
import wiringpi as wp

wp.wiringPiSetupGpio()


m1x=26
m1y=20
m2x=19
m2y=16
m1e=13
m2e=21

wp.pinMode(m1x,1)
wp.pinMode(m1y,1)
wp.pinMode(m1e,1)
wp.pinMode(m2x,1)
wp.pinMode(m2y,1)
wp.pinMode(m2e,1)

def forward(dist):
        wp.digitalWrite(m1x,1)
        wp.digitalWrite(m1y,0)
        wp.digitalWrite(m2x,1)
        wp.digitalWrite(m2y,0)
        wp.digitalWrite(m1e,1)
        wp.digitalWrite(m2e,1)

        print('Moving forward')
        time.sleep(dist)
        wp.digitalWrite(m1e,0)
        wp.digitalWrite(m2e,0)

while(1):
        forward(10)

The program runs but without the motors running. The motors are fine,the H-bridge lights up when power supply is switched on so the problem is with the Raspberry Pi I believe.

Using gpio readall I saw that the voltage of all the pins is always set to 0. I am unable to change the voltage.

The 6 GPIO pins I am using switch to output mode but the voltage remains 0 instead of switching to 1.

I am at my wit's end. Is my pi faulty or is this something fixable?

3
  • Could you run wiringPi's pintest utility or (my) pigpio's gpiotest utility. In both cases you should have nothing connected to the expansion header. By running these tests it will be possible to diagnose the faults (if any).
    – joan
    Mar 31, 2018 at 15:26
  • I ran the pintest utility and it didn't reveal anything new to me. It goes like this: /* The main 8 GPIO pins 0: 7: --> Pin 0 failure. Expected 1, got 0 --> Pin 1 failure. Expected 1, got 0 --> Pin 2 failure. Expected 1, got 0 --> Pin 3 failure. Expected 1, got 0 --> Pin 4 failure. Expected 1, got 0 --> Pin 5 failure. Expected 1, got 0 --> Pin 6 failure. Expected 1, got 0 --> Pin 7 failure. Expected 1, got 0 8 faults detected /* The same for the other types of pins followed by gpio readall which is the same as before. Idk how to format comment so i used /* */
    – Sriram S K
    Apr 1, 2018 at 17:19
  • @SriramSK You can edit your post to add new information instead; the formatting is much more flexible there and you can add a code block if necessary.
    – Aurora0001
    Apr 1, 2018 at 17:32

1 Answer 1

1

It sounds like the GPIO are damaged. There is no way to repair the damage. Generally the damage will cascade through the chip until the chip itself fails. This is usually accompanied by the chip getting very hot very fast from switch on.

pigpio's gpiotest utility is slightly more thorough. If it gives the same results I would accept that the GPIO are now useless.

Such damage is typically caused by feeding more than 3V3 into a Pi GPIO. I think this might have happened days or weeks before the damage becomes noticeable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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