Today I tested a DC driver with a STM32 MCU. The schematic is like this:

enter image description here

I have a problem with the ENABLE Signal between the DRV8840 and the MCU.

When the DC Motor is disconnected, I toggle the EN pin and I can see +12V and -12V alternatively on the out pins of the DRV8840. Everything is OK.

When the DC Motor is connected. The MCU init is OK. When I set the EN Signal, the motor runs. But when I ask to toggle the EN Signal, it keeps 3.3V and the motor can't stop.

I can't toggle the EN Pin when the motor is running. WHY?

I don't understand why. My GPIO Pin is configured as Push Pull Output.

  • \$\begingroup\$ Can you verify that your code is still running when the failure occurs? Try connecting your SWD and see if some kind of fault has occurred. \$\endgroup\$ Jul 3, 2019 at 12:32
  • \$\begingroup\$ Yes my code is still running without any errors. \$\endgroup\$
    – Volt
    Jul 3, 2019 at 12:35

1 Answer 1


Ok I have the answer...

It was due to encoder interrupts. My motor is coupled with an encoder and when I disconnect the motor, I also disconnect the encoder. I tested my program with disabling the interrupt and it is ok.


Your Answer

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

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