Use 2 Dual Max 14870 with Pi 5 simoultaneously

Hi,
im trying to use 2 “Dual Max 14870 for Pi” motordriver simoultaneously on a pi 5 which is why i dont use them as a Hat but have connected them with cables. I wired DIR and PWM to a GPIO and PWM port of the pi 5. Aditionally I connect a ground cable between the Pi and the motordriver. I run the Motors of a battery and the Pi with the Official Pi-Powersupply.
As of now i managed to get both motors (Pololu 20D 12V) working but have the problem that pulling the DIR pin HIGH(changing direction) sometimes results in the Motors stopping until i pull the DIR pin low again. This happens quite randomly and i couldn’t find a pattern except it only happening when i pull the DIR pin to high, never when pulling to LOW. Strangely the motors only seem to stop when changing direction. Writing DIR continously to HIGH works just fine.
I couldn’t find any difference when changing the frequency of the PWM signal or reducing the Duty-cycle. As the motors stop spinning completly I thought that there was an Issue with the PWM signal but I checked it with an Oscilloscope and it looks fine, no matter the state of the DIR pin.

Can this be a problem because i am using 2 different power sources, because i havent connected enough/have connected to many pins to the motordriver or something else?

It should be fine to use two separate power sources as long as they are capable of handling the loads. What are you using for your motor power source?

I recommend checking your ground connection since the behavior your described is typical of a missing or bad ground.

You mention “pulling” the DIR pin high or low several times; could you clarify if you are actually using pull-up/pull-down resistors (either internal or external) or if you are driving the pins high/low directly?

Also, could you post the simplest complete code that demonstrates the issue as well as some pictures of your setup that show all of your connections?

Brandon