Motor driver spins upon attaching to GPIO Pin (raspberry pi) (G2 High-Power Motor Driver 24v13)

Hello Again,
It’s with my great sadness to come to you guys again asking for help!
I purchased this Driver(Pololu G2 High-Power Motor Driver 24v13), and i intent to run Pololu - 4.4:1 Metal Gearmotor 25Dx48L mm HP 12V This 12v motor with it with my Raspberry Pi.

Here is my setup: https://i.imgur.com/3kgvg82.jpg (Sorry about the bad image quality).
And im running this code: import RPi.GPIO as GPIOfrom time import sleep# Pins for Motor Driver Input - Pastebin.com

Problem is, that whenever i connect the PWM pin to ANY of the GPIO ports on the raspberry, the motor starts a “low rpm” mode, without stopping :confused:

I checked my raspberry without attaching the driver to it, to see if it gives any volts, and it dosent.
however, as soon as i plug the PWM to any of the gpio pins its starts to spin :frowning: without me giving it a command.

When i run the program, it rpm starts to go faster(Pwm goes to 50), but does not change the pwm to 100. :confused:
And when program ends, it does not stop the motor. (It goes back to “low rpm” mode.)
Then it crashes with an error i need to resolve from my self. Screenshot - 81e34c4e16e29e089c1ca9ad7d965791 - Gyazo

Im running a Raspberry Pi 4.

Any help would be appreciated, again! :smiley:
Best regards, Daniel.

Hi, Daniel.

From your picture, it does not look like you have a ground connection between the Raspberry Pi and the driver. If that is the case, could you try adding one and see if that resolves your issue? In most situations, you should have a common ground between all of the components in your system.

Kevin

Thank you so much Kevin!
That fixed it!