Welcome! Log In Create A New Profile

Advanced

Pin D2 and X motor driver steps

Posted by chantling 
Pin D2 and X motor driver steps
December 11, 2017 08:06PM
I'm trying to get a laser diode working with my Tevo Tarantula. It's running a Biqu MKS Base v1.4 with Marlin. I spent quite a bit of time trying to get PWM control working; ended up using the X+ endstops (pin D2), as there were no other PWM capable pins available on my board except D11 and D12, down in the servo group. I had to cobble together a circuit to translate the TTL from D2 for my laser driver, as the voltage doesn't go all the way to 0V, but eventually got it all working. Now I've got a smoothly controllable laser power output. Thought I had it all figured out.

Until I actually tried to run some gcode with the laser attached. As soon as D2 is activated via M3, the X axis suddenly moves about 10 times faster and further than it should. One millimeter movement scales to around 10mm. It stays this way until the printer is reset, even if I turn off the pin completely using M42 P2 S0. The only way to get the movement back to normal is to reset the printer. Then it works as expected until the M3 command is used.

I thought perhaps my circuit was causing an issue, but it happens even without the laser and circuit being connected. It's like activating PWM on that pin throws off the timing for the X motor driver. But as best I can tell, timer3 controls pins 2, 3, and 5, none of which have anything to do with the x stepper drivers according to pins_ramps.h. Pin 2 defaults to X+, though I'm using it for Laser speed; 3 is X-, and I can't find what pin 5 does. Marlin defaults it to a filament width sensor pin and says it's "Analog Input on AUX2", which my board doesn't seem to have. Even if one of the pins were somehow connected to the stepper driver, I can't see how enabling PWM on one could cause issues on another. Changing the PWM timing might cause problems, but I'm using the default timings. Went back and verified against the stock Marlin settings to be sure.

Tried to switch my speed pin from D2 to D11, as it's currently sitting unused in my servo group, but the sanity check throws an error because I'm trying to use it on a system timer. D12 and D13 are also apparently on the same timer and Marlin won't let me use those pins either. I commented out the declaration of D11 as servo0 and tried setting the output manually with M42, but it acts like it's not capable of PWM. It's floating until I set it to a value, and values below around 250 are all low, values above that are high. D11-13 are all supposed to be PWM capable, so I'm not sure what's going on there.

Anyway, can anybody tell me why my motor driver loses it when I try to use PWM on pin D2?
Sorry, only registered users may post in this forum.

Click here to login