DRV8833 motor runs unwantedly upon battery connection

My DRV8833 is connected to Raspberry Pi with Ah, Al, Bh, Bl pins connected to 4 GPIO pins to control 2 DC motors, and powered via a 5V 5A UBEC-convereted NiHM battery. And the Pi connected to a separate battery.

What I found interesting / frustrating is that, if my Raspberry Pi is off, one of the motors starts to run on its own. Or it would just run automatically as soon as DRV8833 is powered up. :confused:

At the moment I could only get the motor to stop by manualy sending a LOW signal to the DRV8833 sleep pin on boot, but it would take around half a minute to finish booting up, which is practically too long, e.g. rover start hitting into walls during this booting period.

Is there a way to save the sleep state to LOW without connecting to the microcontroller (Pi / Arduino)? Or any other suggestion to keep the motor stopping until we ask it to run? :unamused:

Hello.

Can you post a schematic or picture that clearly shows how you are connecting your RPi to the DRV8833?

-Jon

So I found that GPIO pin 4 is the one that is giving me the headache as it turns the right motor forward.

I changed DRV8833 AIN2 wiring to GPIO pin 18 and now it works fine. No more unwanted moves during boot.

Problem solved. That still doesnโ€™t explain about what is so special with Pi pin 4 though :confused:


I am glad your setup is working. Using GPIO4 probably caused that behavior because GPIO0 through GPIO8 on the Raspberry Pi are pulled high by default when the RPi powers on (the other pins you were using were pulled low). You can verify this by referring to section 6.2 of the datasheet for the ARM processor.

-Jon