I have an BluePill board (Arm Cortex M3 Dev. Board). Also a a4988 stepper motor driver. BluePill is powered from usb of my PC. Stepper motor driver is powered by external power supply which is 220V -> 12V. Both my pc and the external power supply are connected to same plugs. The grounds are wired between a4988 and BluePill. The weird problem is, when I connect my PC13 pin to STEP pin. I can smoothly drive my stepper motor. When I connect to another pin such as A7, A6 my stepper motor turns randomly. Power supply and wires are too close to each other (approximately 10-15cm). I think that emf occurs on the wire and the noise causes to move motor randomly but why it doesn't happen when I connect it to PC13.

When I connect a wire to STEP pin and the other side of wire is unconnected, there is also random turns.

Added my setup as @laptop2d said. Here is my setup

  • 4
    \$\begingroup\$ Provide a diagram of your setup, we are not at your bench and its too hard to troubleshoot problems via telekinesis \$\endgroup\$ – Voltage Spike Nov 8 '18 at 18:12
  • 1
    \$\begingroup\$ @Ames: Please embed your image into your post. This has several benefits: all the information will be in one place; we can read the text and see the schematic at the same time; more people will respond since they don't have to follow links; the question will still be intelligible when the link dies. \$\endgroup\$ – Transistor Nov 10 '18 at 10:10
  • \$\begingroup\$ I could not because when i pressed img button, stackexchange adds with invalidated img url, so I added to my google drive and linked to post \$\endgroup\$ – arnes Nov 10 '18 at 10:14
  • \$\begingroup\$ guys any help ? \$\endgroup\$ – arnes Nov 17 '18 at 19:14

On the BluePill board, PC13 sinks LED1 through a resistor. So it's 3v3 -> LED -> resistor-> PC13 -> step pin. Try enabling pull-up on the other pin you want to use eg A7.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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