Understanding the MKS Gen L V1.0 and GRBL

Hi, I’m posting this here because all other avenues have yielded no help so please excuse me if I’ve overstepped.
I have identified the above board as something I would like to explore some projects in using GRBL.
I want to connect a diode laser module to the board, and these usually have 3 output pins, 12v +/- and PWM.
Accordingly the seemingly best available PWM output on the board, although I stand correcting, is P2.5, a large mosfet.
In the documentation for smoothieware it shows how to allocate the pin.
However, in GRBL I am presented with the following:
// The LPC17xx has 6 PWM channels. Each channel has 2 pins. It can drive both pins simultaneously to the same value.
// PWM Channel PWM1_CH1 PWM1_CH2 PWM1_CH3 PWM1_CH4 PWM1_CH5 PWM1_CH6
// Primary pin P1.18 P1.20 P1.21 P1.23 P1.24 P1.26
// Secondary pin P2.0 P2.1 P2.2 P2.3 P2.4 P2.5
#ifdef SPINDLE_PWM_PIN_1_23
#ifdef SPINDLE_PWM_PIN_2_4

I haver no idea where to go with this as I am new to these languages, although it is of definite interest as I would also like to run a machine spindle from the board through the same machine framework.

Could someone explain to me the necessary steps I need to take please to make this work?

Apologies for the length of the post, Laurence.

Okay so I’ve made some progress on my own but could someone explain the above statement in GRBL to me please?
Many thanks, Laurence.

As it’s stated in the code, you can enable/disable the primary and/or seconday pin. which pins this are depends on the channel you select.

The ifdef statements are compile switches. They are used as “shurtcuts”. If there is a
define SPINDLE_PWM_PIN_1.23
in config.h, then the pwm pin is configured on pin 1.23.

Claudio, could you tell me please if the pwm voltage is negative, i.e. suitable for a Co2 laser, or if there is a way to convert it?

many thanks, Laurence

If you use the default MOSFET output, then the PWM is inverted, meaning the pin of the LPS is pulled to GND when PWM is on. If you use the pin 1.23 directly, then the PWM is NOT inverted, meaning at 100% PWM you get around ~4V.

There should never be a negative voltage! You have to connect the GNDs of the LPS and the MKS board.

when I look on Amazon for the MKS Gen L v1.0 it states it is the AVR 2560 + RAMPS combined in one yet when I see the configuration header file snippet for GRBL it mentioned LPC17xx so I’m confused because the LPC17xx are 32bit boards and there is a GRBL-LPC for those boards.

Are you using standard GRBL or are you using GRBL-LPC?

I didn’t check what MCU the MKS Gen L has. but it seems it’'s the old known 8bit Atmel :rofl:

Grbl-LPC is only for 32bit boards with an LPC 176x MCU.

1 Like

yes, that’s why seeing that mention of the LPC17xx in that configuration.h segment caused me to pause mentally.

Thanks everyone for their contributions but due to supply difficulties in the UK of this board and our identifying a better option I won’t be pursuing this any further.

many thanks, Laurence