Marlin spindle PWM control using HE1 on SKR v1.4turbo

I’m trying to use HE1 in my SKR v1.4turbo board to control spindle motor. I managed to configure marlin and it works if I give up PWM and just set SPINDLE_LASER_ENA_PIN to P2_04 - then I can switch it on with M3 and switch off with M5. But I’d like to use PWM to control speed of the motor - and here I’m stuck, as marlin requires to set both SPINDLE_LASER_ENA_PIN and SPINDLE_LASER_PWM_PIN - but I see just one pin for this mosfet output.

I tried to not setting ENA_PIN at all, but then I get compilation error: “(SPINDLE|LASER)_FEATURE requires SPINDLE_LASER_ENA_PIN or SPINDLE_SERVO to control the power.”

When I set both to the same pin, I just get constant 12V output regardless what power I set with “M3 Onn” (I checked with the oscilloscope and there’s just constant voltage).

So how should I set these to settings? Is it possible at all to use HE1 form motor PWM control?

I’m not sure HE1 is a PWM pin. Usually the fan pins are PWM, so you might try one of those instead. I assume you are trying to get 12V out to drive a 0V to 10V input for the spindle. Plus I’m a bit confused. SPINDLE_LASER_ENA_PIN and SPINDLE_LASER_PWM_PIN need to be different pins, though for some applications, you don’t have to hookup the enable pin to your external device.

That’s what I considered - assign ENA_PIN to some free pin and then don’t use it - but I don’t like this, it’s kinda hacky, I’m looking for some “proper” solution.

HE1 is PWM, and this board has only one PWM fan (fan0, all other, that is fan1 - fan3 are connected directly to the power so they are always on).

Oh, I tried with some unused pin (P1_24 - it’s for the neopixel leds) and it didn’t work (I had no signal on PWM pin) and then I realized I had no #define SPINDLE_LASER_USE_PWM in my config. So I added it - it worked great, so I changed back to setting both ENA_PIN and PWM_PIN to the same pin used by HE1 output (P2_04) - and it still works.

So the solution is to assign the same pin to both ENA and PWM - just don’t forget to uncomment USE_PWM then :wink:

2 Likes