Laser module PWM

I’m hoping for some help from someone. I’m trying to figure out which pin supplies the pwm signal to the laser module. I know it is the same pin used for the step on the 3d print module but without a working machine that doesn’t help much.

Much appreciated,
-Atom

1 Like

I don’t follow - the laser PWM is sent from the main controller, not controlled by the laser toolhead’s on board mcu. Are you asking which pin on the cable connector is it?

1 Like

witch of those holes corresponding to pin pe14 :slight_smile:

I don’t have a controller anymore, but I have a laser head (camera was defective) that I want to put on another machine. SM chose to integrate the mcu and laser driver onto one board. Luckily they still feed it with a pwm. My hope is that if I apply voltage and a pwm signal the laser head will still fire :). But I need to know what pin on the laser head is the signal pin (reads the pwm to controll laser diode currant).

Nope, no silkscreen on them at all just a “p1” to denote that it is the main plug… luckily I just found this post. Witch does answer my question perfectly.

Thanks for the help and I will post if I get this thing working XD

1 Like

Godspeed! Post an update!

Interestingly enough there are only 2 laser definitions and neither are pin pe14. I will admit that I don’t think this makes a difference for me. But it is interesting.

#define E0_STEP_PIN PE14
#define E0_DIR_PIN PB10
#define E0_ENABLE_PIN PB11

/**

  • TODO: Currently using same Enable pin to all steppers.
    */

#define E1_STEP_PIN PE13
#define E1_DIR_PIN PC10
#define E1_ENABLE_PIN PD11

#define E2_STEP_PIN -1
#define E2_DIR_PIN -1
#define E2_ENABLE_PIN -1

//
// Misc. Functions
//
#define SDSS -1
#define LED_PIN -1

//
// Heaters / Fans
//
#define HEATER_0_PIN PA15 // EXTRUDER 1

#define HEATER_BED_PIN PA7 // BED

#define LASER_PIN PB1
#define SPINDLE_LASER_ENABLE_PIN PB10

#define CNC_PIN PB1

Hey, sorry, this is going to look weird but I nuked all my posts that had wrong info in them. I don’t think it’s that pin anymore, I think it might be PB14. I can’t quite figure out which port group it’s on because I can’t quite figure out exactly what timer is being used, and also what channel is getting used.

The timer setup is here in Tim1PwmInit()

  GPIO_PinRemapConfig(GPIO_FullRemap_TIM1, ENABLE);
  GPIO_InitTypeDef GPIO_InitStruct;
  GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_InitStruct.GPIO_Pin = GPIO_Pin_14;
  GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(GPIOE, &GPIO_InitStruct);
...

So if it’s Tim1->CCR4, like the code reads, then it should be “Channel 3”, and since it’s full remapped, I think that puts it on PB11 actually.

I’m pretty confused what GPIO_Pin_14 means…

image

I’m new to this chip and architecture, still learning.

Yes that is specificly for the timer. I was looking to see what pins they mapped m3-m5 to. I will trust their flow chart(at least for the moment) that they are remaping the step pin for pwm (because it makes sense to me that they would do so). Mostly I wanted to see if they where actually utilizing the plug pins above labeled “en” and “dir”. (I assume they use an enable signal)

Or am I wrong in thinking the best way to approach this would be to start with the g code? After all we know they use m3&5 to control the laser so if we want to see what pins are used for what look at what pins are mapped to those functions. Once we know the pins we can find what outputs are linked to what pins then I know what wires the signals are sent on. Or do I have a critical failure in my logic?

Also if they were using timer 1 channel 2 it would map to bp10 witch would make since with the pins.h definition.

So I have had no luck with that laserdriver. I’m beginning to think it requires a handshake over CAN before it will output power to the laser diode.

I’m not positive on the pins, but the laser module firmware does very little: Snapmaker2-Modules/laser_head.cpp at main · Snapmaker/Snapmaker2-Modules · GitHub

I agree, but I tried applying pwm on the step pin while giving an enable to both the en pin and the direc pin with no results. I can’t find any other info on what other possible pin combinations it could require. And without a schematic or a working device to test outputs from all I can do is just guess randomly at all possible combinations. (Though I guess there are only 4 unused pins so it wouldn’t be horrible.)

You didn’t mention, so sorry if this was implied, you were giving power and ground also right?

Wonder how hard it could be to trace the pcb traces…The driver is probably under a heatsink.

Correct…

And a line for 20 charrecters

Might be possible. But I’m not having a lot of luck, it seems like they are not using the led driver in a standard configuration. The current sense pin seems to be hooked up to a diode&transistor circuit rather than a standard voltage divider, with the pwm input. That’s what led me to belive it is getting a signal from the mcu… the code does clearly allow for an e-stop (might double as the enclosure door safety?) And we know that when the enclosure door is open the laser operates at extremely low power. Maybe there is an interlock there to override the normal pwm signal?

That’s all done in software in the main controller.

Do you have any idea what the “nc” pin is for?

Also do we have any info on the kind of pwm signal that is given by the controller? I can’t find any info on frequenc.