How-To: Modify Marlin to control a laser with an SKR Pro

No probs brother. We gonna get this!

Well crap! Now my skr pro wont take the .bin…

I am so close! This skr only has had the 1 firmware on it. Researching…

NOOOOO, dang it.

I have had some weird issues. unplug everything and switch the jumper to usb, plug in a usb for power and let it flash. That solved it for 3 boards I thought I fried.

I’m still in the shop I can’t test the firmware just yet, getting tired so probably tomorrow.

My board wont load firmware from the sd card for some reason but I think I flashed it with a STlink starting at address 8008000.

I tested it with the 37mm test file and this time the laser fired while running the code. It still powers up at boot but I can deal with that later. The bigger issue for now is why a brand new board is not taking firmware from the SD. Between this and my 1.3 its making me question the SKR boards.

That being said, loading firmware from IDE was always a little sketchy even on the ramps stack!

We are leaving for Black Butte for a few days tomorrow so have a happy new year! I am sure I will check in to see if anyone else has any comments.

Later.

1 Like

I did confirm with the TFT marlin mode that I successfully loaded the firmware with the STlink.

Thats pretty cool. :sunglasses:

3 Likes

Pretty cool that it puts the git commit hash in there. That makes me smile :slight_smile:

1 Like

I am super glad it shows that. I already had a bug fix branch on it and needed confirmation that the stl flash worked.

1 Like

I’m running Marlin_V1CNC_SkrPro_DualLR_2209_2.0.7_506-src version on my SKR Pro V1.2 to control my LowRider2 CNC. All works well with the dual end stops. Now I want to take the next step in getting the Spindle going with the M3 command. Reading thru the topic I think I learned what I had to add.

In the Configuration_adv.h file I have enabled;
#define SPINDLE_FEATURE
and added;
#define SPINDLE_LASER_ENA_PIN PC1
#define SPINDLE_LASER_PWM_PIN PC9

In the
the fastio.h file I’ve marked out the first line and added the second. The third line was already there.
//#define PWM_PIN§ digitalPinHasPWM§
#define PWM_PIN§ true
#define NO_COMPILE_TIME_PWM

when I compile I get the following errors.
WHAT AM I DOING WRONG?

Compiling .pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\tft\tft_spi.cpp.o
In file included from Marlin\src\HAL\STM32…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\HAL.cpp:28:
Marlin\src\HAL\STM32…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\HAL.cpp.o] Error 1
In file included from Marlin\src\HAL\STM32…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\HAL_SPI.cpp:25:
Marlin\src\HAL\STM32…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
In file included from Marlin\src\HAL\STM32…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\MarlinSerial.cpp:22:
Marlin\src\HAL\STM32…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
In file included from Marlin\src\HAL\STM32…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\eeprom_sram.cpp:25:
Marlin\src\HAL\STM32…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
In file included from Marlin\src\HAL\STM32…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\Servo.cpp:25:
Marlin\src\HAL\STM32…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
In file included from Marlin\src\HAL\STM32…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\eeprom_sdcard.cpp:29:
Marlin\src\HAL\STM32…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
In file included from Marlin\src\HAL\STM32…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\eeprom_wired.cpp:25:
Marlin\src\HAL\STM32…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
In file included from Marlin\src\HAL\STM32…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\Sd2Card_sdio_stm32duino.cpp:23:
Marlin\src\HAL\STM32…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
In file included from Marlin\src\HAL\STM32…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\fastio.cpp:25:
Marlin\src\HAL\STM32…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
In file included from Marlin\src\HAL\STM32…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\eeprom_flash.cpp:25:
Marlin\src\HAL\STM32…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
In file included from Marlin\src\HAL\STM32\tft…/…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\tft\tft_fsmc.cpp:23:
Marlin\src\HAL\STM32\tft…/…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
In file included from Marlin\src\HAL\STM32\tft…/…/…/inc/MarlinConfig.h:50,
from Marlin\src\HAL\STM32\tft\tft_spi.cpp:23:
Marlin\src\HAL\STM32\tft…/…/…/inc/…/HAL/STM32/inc/SanityCheck.h:32:4: error: #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
32 | #error “Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32.”
| ^~~~~
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\MarlinSerial.cpp.o] Error 1
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\Servo.cpp.o] Error 1
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\eeprom_sdcard.cpp.o] Error 1
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\eeprom_wired.cpp.o] Error 1
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\HAL_SPI.cpp.o] Error 1
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\Sd2Card_sdio_stm32duino.cpp.o] Error 1
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\eeprom_sram.cpp.o] Error 1
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\fastio.cpp.o] Error 1
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\eeprom_flash.cpp.o] Error 1
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\tft\tft_fsmc.cpp.o] Error 1
*** [.pio\build\BIGTREE_SKR_PRO\src\src\HAL\STM32\tft\tft_spi.cpp.o] Error 1

1 Like

I can’t remember the fix offhand. @Tuco found it. It is in the nightly builds, and it will be in v509, whenever that comes out.

Thanks.
I did follow Tuco’s post but still get the error.
I made a work around for now. I have OctoPrint turn on one of the fans before the print and turn it off after printing. Not perfect but it get my process more automated.
I use the same for cooling the steppers and Arduino with a fan. It works well.
Thanks for your reply.



I HAVE A 6 WATS LASER to plug to the same board but 4 wire connection how do i connect it !
i try few thing and laser went dead 8-(( !

there is no power on off switch on it !
i plug for the 12 volts and the other it says TTL !

i understand but on whitch outputt it is supposed to trigger the volts ?

i have 2 problem i used 2 laser 1 is TTL 12 volts 5.5 wats it work whit M106 commans !

But the other one 6 wats used TTL 5 volts so it means i will need to used the PC9 and ground pin but i dont now what command to used to trigger this pin !

And i order a 40wats one but i will ask the selers what input the TTL used and set it to the good outputt !

by resumé i need to get 2 outputt for the laser 1 for 12 volts and 1 for 5 volts !

and the command to activate the 5 volts one !
by the way i had modify the firmware to activate the M3 command to activate my Dewalt router !
i just burnd 1 laser by using 12 volts instead of 5 volts i dont want to burnd an other one !

i made the test whit the screen the PC9 work for laser ! but your file 37 mm smooth.gcode do not work at all on PC9 !

i cant understand what code i need to putt to activate the PC9

Have a look here, How-To: Modify Marlin to control a laser with an SKR Pro

Hey Ryan: you just reference the same topic we are in.

francois: I don’t have a SKR Pro, but I’ve been following laser topics on this forum, and this is my understanding:

  • If you are using a later version of the Marlin firmware maintained by V1, then the laser code is enabled. You don’t have to make any changes to Marlin, though it will be expecting inline laser commands using the S parameter of the G0, G1, G2, and G3 g-codes.
  • The 12V wires sticking out the right side of your picture are in parallel with the 12V plug. You use one or the other depending on how you want to wire up your laser.
  • I’ve never understood the difference between TTL and PMW, but most of the boards I see on this forum feed the TTL connection with a PWM signal. One of the two TTL wires will go to ground on the control board, the other will go to the/a laser pin, and it is polarity sensitive.
  • The pin assigned for the laser in the SKR Pro version of Marlin maintained by V1 is currently PC9, and is specified in the top of configuration.h (in case you want to change it). You can find a pinout diagram here, and PC9 in Extension-1 at the bottom of the image.
  • Laser control modules like the one in your image will expect a certain voltage of PWM/TTL signal. Newer modules will often accept a range of voltages. You need to figure out what your module is expecting. The SKR Pro is a 3.3V board. If your laser board expects 5V signals, 3.3V often works (it doesn’t hurt to try), but you may have to wire up a level converter to get it to work.
  • I would not expect your laser to come on until you apply a PWM signal, though I would expect an LED to be lit on the board when you have 12V power applied.
  • You should be able to directly set the PWM level of your PC9 pin (for testing) using M42 g-code, though you may want to try using the laser controls from your menu first.
1 Like

thanks for the info !
so i will have to plug the ttl 5v to pin PC9 but the ground can i putt in the ground just behind it ?
if i understand good i do not use M106 and M107 whit this pin PC9 , i will need to used M42 insted but i dont exactly understand how to putt the command !



should i used like —>>> M42 PPC9 S255 for full power
and M42 PPC9 S0 to off power ?

Sorry I should have doubled checked. I was shooting for the post with the pictures of the pins.

Have a look at the file we use to test, https://forum.v1e.com/uploads/short-url/csGbgLE0JBTMDttY98thm4gvSN3.gcode

I believe any movement with an S command will work, G1 X24.89 F2220 S15. But the easiest way to test is the menu built into the LCD.

Seeing this it looks like it is time to update the laser page.

From the pinout diagram, the ground pin is to the left of PC9:
New Project (1)

i do not use M106 and M107 whit this pin PC9 , i will need to used M42 insted but i dont exactly understand how to putt the command !

You can activate the pin in several ways. According to Ryan, the menu on the LCD should work. Second, you can send an inline command like Ryan suggests.

G1 X1 S255

The S parameter specifies the laser power out of a range of 0 to 255.

should i used like —>>> M42 PPC9 S255 for full power
and M42 PPC9 S0 to off power ?

This is the correct syntax, and I’ve used it successfully on a Rambo board. As I said before I don’t have a SKR Pro, so I cannot verify.


If you own a multimeter, you might consider putting it on pin PC9 and then executing the g-code and/or the menu. This way you can verify that you have the pin working correctly with whatever commands before you hookup your laser.

i made some test and i found all my answer

there is 2 way to plug it the TTL laser !

The TTL who work with 5 volt use pin PC9 and the ground next to it but is recived a M3 S255 only 2.5 volts it is used for hight power laser !

The TTL who work whit 12 volts used PC8 FAN0 connection sending M106 S255 recived 12 volts !

this is with the (V1 Engineering, Ryan, 510DL) version

i understand but on whitch outputt it is supposed to trigger the volts ?

i have 2 problem i used 2 laser 1 is TTL 12 volts 5.5 wats it work whit M106 commans !

But the other one 6 wats used TTL 5 volts so it means i will need to used the PC9 and ground pin but i dont now what command to used to trigger this pin !

And i order a 40wats one but i will ask the selers what input the TTL used and set it to the good outputt !

by resumé i need to get 2 outputt for the laser 1 for 12 volts and 1 for 5 volts !

and the command to activate the 5 volts one !
by the way i had modify the firmware to activate the M3 command to activate my Dewalt router !
i just burnd 1 laser by using 12 volts instead of 5 volts i dont want to burnd an other one !