PlatformIO Community

GPIO pins are being toggled when establishing a debugging connection

I am using an ESP32-Devkit V1 as an embedded motor controller. It is hooked up to a DRV8835 Polulu Dual Motor driver to which I have connected two DC motors.

Everything seems to be working fine when I upload and execute the program without debugging.

However when I upload and debug via JLink the motor control pins are kept high, which in my case spins the motors at full speed. This happens during the connection phase. Once the program is executing and hits the first breakpoint at the setup() function the motors stop spinning. When I disconnect the debugger the motors also spin at full speed for a split second.

What could be causing this and is there a workaround to stop this from happening?

Screenshot 2022-04-26 204148


debug_build_flags = -Os -ggdb3 -g3

to the platformio.ini (docs) and start debugging again and let it run. Does it work as before?

I was able to resolve or at least figure out what the issue here is.
I was using GPIO pin 5 which receives a PWM signal during boot. Because the boot process is longer when the debugger attaches the motor noticeably spins. During regular booting I am also experiencing the motors spinning, but its just for a split second.

1 Like