Aux1 pin output

I am trying to send an output signal on Aux1 to control a spindle. Maslow 4, board version V1.10b

I have updated the yaml to:
spindle:
on_off:
output_pin: gpio.48

i would expect to see Aux1 go high when i send M3 and off when i send M5. but nothing seems to change.

using the right most extra 4 pin connector. Top Pin should be gnd, then 3.3V, Aux1, and Aux2 at the bottom, right?

i have previously successfully used Aux1 (GPIO.48) as an input to set my Z0 with a probe

1 Like

That is a great question. I didn’t know the answer so I asked the AI and here’s what it came up with. It seems reasonably on point to me, but you never really know with AI generated stuff. At least it seems like a starting point to explore from:

The Issue: M3 Without a Speed Value (S) Won’t Toggle the output_pin

Looking directly at the OnOff::setState and OnOff::set_output source code:

MaslowCNC / Maslow_4 / firmware / FluidNC / src / Spindles / OnOffSpindle.cpp

void OnOff::setState(SpindleState state, SpindleSpeed speed) {
    // ...
    uint32_t dev_speed = mapSpeed(speed);
    if (state == SpindleState::Disable) {
        if (_zero_speed_with_disable) {
            dev_speed = offSpeed();

The output_pin (Aux1/GPIO.48) only goes HIGH when dev_speed != 0. That means:

  • M3 alone (no S value, so speed defaults to 0) → pin stays LOW :cross_mark:
  • M3 S1000 (or any non-zero S value) → pin goes HIGH :white_check_mark:
  • M5 → pin goes LOW :white_check_mark:

Fixes / Things to Try

1. :white_check_mark: Always include a speed value with M3

gcode

M3 S1000

This is the most direct fix. Any non-zero S value will work since the OnOff spindle only cares whether speed is zero or not.

2. :white_check_mark: Double-check your YAML structure and spindle type name

The YAML must use the correct type key OnOff (capital O, capital O). Here’s a correct minimal example:

config.yaml

spindle:
  OnOff:
    output_pin: gpio.48

:warning: Your config snippet shows:

YAML

spindle:

on_off:
output_pin: gpio.48










**`on_off` (lowercase) is wrong.** The registered name in the firmware is `"OnOff"` (mixed case). If the type key doesn't match exactly, the spindle config won't load and the pin won't be claimed at all — which would explain why nothing changes.

3. :white_check_mark: Confirm the spindle config actually loaded on boot

After uploading the YAML and rebooting, watch the serial/terminal startup log. You should see a line like:

Code

[MSG:INFO] OnOff Spindle Ena:NO_PIN Out:gpio.48 Dir:NO_PIN

If you don’t see this line, the spindle config didn’t parse correctly (likely the YAML key name issue above).

4. :white_check_mark: Pin connector orientation — you’re right

You confirmed GPIO.48 works as an input for probing, so the pin is real and accessible. The 4-pin connector pinout you described (GND, 3.3V, Aux1, Aux2 top to bottom) is consistent with the Maslow 4 board design. No issue there.

5. :warning: Note: GPIO.48 output is 3.3V logic level

The Aux pins output 3.3V logic (not 5V, not 12V). If your spindle controller requires a higher-voltage signal or a relay, you’ll need a level shifter or signal relay in between.


Summary

Problem Likely Cause Fix
Nothing changes on M3 Speed was 0 (no S value) Use M3 S1000
Config not loading YAML key on_off should be OnOff Fix YAML key to OnOff:
No startup log message Config parse failure Fix YAML + check serial log

The most likely root cause is a combination of the YAML key name (on_off vs OnOff) and not passing a speed value with M3.

I just re-read my post and “that’s a great question” even sounds like something the AI would say, but that was my part. I am becoming the AI :pensive_face:

1 Like

haha, you’re right, that part really did sound like AI. i’ve been asking Gemini for days but it tends to make thinks up!

i tried the suggestions and used M3 S1000 instead of just M3. I adjusted the spindle section. i am using two spaces before OnOff: and 4 spacing before output_pin: but i get that error message that shows it thinks that i don’t have any space indents. i am definitely using spaces and not tab

spindle:
OnOff:
output_pin: gpio.48

[MSG:WARN: Ignored key spindle]
[MSG:ERR: Skipping key OnOff indent 2 this indent 0]
[MSG:ERR: Skipping key output_pin indent 4 this indent 0]

1 Like

Just generic debug suggestions, I’ve no experience in exactly what you’re doing:

  • If your Z-probe stuff used to work, if you try that again does it still work on this version of the software? What error if not?
  • What happens if you try Aux2 rather than Aux1?

Annnnnd do we know if spindle control has ever worked?

Thanks Dave. Z-probe still seems to work on Aux1 when i add that back in.

I have also tried assigning gpio.48 to the coolant or flood section and controlling those with the appropriate G code. but not luck there either.

i would like to try Aux2, but according the the schematic it should be gpio.38 but i can’t seem to use it because gpio.38 is already being used elsewhere in the yaml, i guess for controlling a motor driver.

tmc_2209:
uart_num: 1
step_pin: gpio.46
direction_pin: gpio.38

never mind on that comment about the flood command, it actually works!
M8 to turn on and M9 for off. i can make that work to control my spindle easy enough.

Even so: i am still very curious about what gpio to use for Aux2 and how to get the spindle command working

coolant:
flood_pin: gpio.48
mist_pin: NO_PIN
delay_ms: 0

ok got the Aux2 issue solved. just changed the currently assigned gpio.38 pin to NO_PIN and used gpio.38 as my coolant pin.

still not sure what is up with the spindle command though.

2 Likes

That sounds like a bug. I will fix that in the template maslow.yaml file. Thanks for catching that!