GRBL-LPC M3 command doesn't work with USB enabled?

I have been working off and on trying to convert my JCUT laser cutter to use a MKS SBASE controller board with grbl-lpc installed.

I had previously asked a question about configuring some outputs in open drain in this thread:

I configured it like it shows in that thread and that seemed to work I think.

My initial plan was to use an MKS-TFT display to load and run files on the laser cutter. So I configured grbl-lpc to disable the USB port because my display wouldn’t connect to the MKS SBASE if USB was enabled. From the MKS-TFT display I can enable the laser power supply by clicking the “open laser” button or by clicking on a custom button that sends an “M3” command.

However, because the MKS-TFT software is really limited, I have decided to control the laser cutter over USB from Lightburn (running on a linux box). So I re-enabled the USB in the grbl-lpc serial.c config file and recompiled. With that firmware I can control the movement of the laser from Lightburn or by sending serial commands from a terminal, but I can’t get it to enable the laser by sending the “M3” command from lightburn or a terminal. When I issue an M3 command the MKS-SBASE responds with “ok”, but the enabled light on my LPS doesn’t light up like it does on when I issue the same command from the MKS-TFT display when I have the USB disabled firmware installed.

Does anybody have any idea why that would be? I’m controlling the Spindle Enable signal with the P1.30 pin that doesn’t seem like it has anything to do with usb or serial communication according the the schematic I’m looking at?

The default output for the Laser PWM is the MOSFET on P2.5 (connected to L in K40 LPS). Grbl-LPC can not send the laser PWM signal on P1.30. Only specific pins are supported.
See cpu_map.h for details:

1 Like

Thank you for the reply. I wasn’t trying to use P1.30 as the PWM spindle output, just a active low spindle enable signal.

Looking at the comments in the config.h file closer I see that if using a PWM Spindle then I’m supposed to use the Spindle DIR pin as a spindle enable.

However, I have now configured the Spindle Enable to P2.7 (one of mosfet heater outputs) and that is now working for me.

I’m not sure why P1.30 as the Spindle enable didn’t work with USB enabled, or why it worked with the the MKS display when USB is disabled.

Well, I almost have it working. I can enable my laser, but my actual laser power output is reversed from the percent output requested. Cutting with 1% power cuts better/deeper than cutting with 100% power which does hardly anything.


Which output do you use for the power?
MOSFET outputs do pull to GND, which means they invert the PWM signal. If you need a non inverted PWM signal, you best use P1.23 (instead of P2.5 MOSFET).

I think that P1.23 is a 3.3V output, so if there is no way to invert the PWM signal to P2.5 in the firmware, I guess I either need to:
a. wire P1.23 to the LPS PWM input with and opto-isolator
b. wire P2.5 to the LPS PWM input through an inverter.

For simplicity I could go back and give smoothieware a try. I had given up on it because it didn’t work well with the MKS-TFT, but since I’m not using that any more maybe it would be easier.


You are right, P1.23 is a 3.3V output, but you don’t need 5V on the IN pin, because this would aniways generate too much power for the tube. 3.3V should be enough to generate ~15mA tube current.

I assume the ~15ma tube current recommendation is for a 40W laser tube, right? Or is that a general recommendation for all CO2 tubes. I have a 60W laser tube and googling it says that max current is ~20mA. I would hate to lose 25-30% of my available power if I don’t have to.

Still, that might get me working for now.

EDIT: Another problem is that my breakout board has a pullup resistor to 5V on the LPS PWM line that I would have to desolder.


The max current is dependant on the tube. Check the spec of your tube for details.
For example: The max current of a Reci 100W CO2 tube is 24mA.