Welcome! Log In Create A New Profile


M106 P0 controls D8, but D9 is always on

Posted by maccadacca 
M106 P0 controls D8, but D9 is always on
June 09, 2022 10:51PM
I have a Mega2560 + RAMPS1.4 controlling an old 3d printer that I want to convert to a laser engraver, and I followed this page from marlin on how to set this up for lasers.
I've been trying to test with a fan on the laser pin instead of a laser, cos, well, fans are safe to look at.
I have
#define IS_RAMPS_EFB
and therefore

and also
#define SPINDLE_LASER_ENA_PIN 4 // Pullup or pulldown!
#define SPINDLE_LASER_PWM_PIN 9 // Hardware PWM

When I send M106 commands in pronterface, only P0 responds to commands on D8. D9 is just always on at 255, even though when I send commands with M106 P1 the LED appears to recognise on or off.

I'm not sure what's wrong, or how to fix this - I've been combing these forums for a fix for a few days now, and haven't seen the same problem.
Can anyone help fix this pin issue?

Or, alternatively, is it simple to have the software just recognise that the laser is on pin 8? I tried defining FAN_PIN to D9 and LASER_PWM_PIN to 8, but it jsut doesn't work at all then - 9 is always on, and 8 doesn't respond at all. It's like 9 is on regardless and whatever the laser pin is set to just won't work, but the fan is fine?

EDIT: further data point - even when I define neither of these to be D9 - fan to 8, laser to 10, D9 is still always on, and I can't get anything other than D8 to do PWM

I'm considering a workaround where I go through and wherever it tries to laser, I just make it use the fan instead, but that seems an awful hack ...

Edited 2 time(s). Last edit at 06/09/2022 11:18PM by maccadacca.
Re: M106 P0 controls D8, but D9 is always on
June 09, 2022 11:32PM
Sound like d9 is damaged

run ramps test firmware [reprap.org]

It moves all steppers and turn all mosfets on and off
no safty checks....
Re: M106 P0 controls D8, but D9 is always on
June 10, 2022 10:48PM
Cheers Dust, that was a good test! Looks like D9 is just permanently on and therefore damaged. This a known thing? Like is there a way to know if it's just "oh just replace the MOSFET for D9" or could it be anything in the circuit (this is fairly new, and i haven't really been screwing around with it, just placed the stepper drivers, and tested those and they work)?

Or alternativeely - D10 PWM works just fine, but I don't know how to control it with gcode. I've tried M106 P2, on the basis that D8 appears to be P0 and theoretically D9 is P1, but I could be completely off. Is there any other enable/change thing I need to do in the code?
Or do I just need to set laser pin to D10 and run a test engraver pattern? (ideally I wanna unit test the laser before letting it run free)
Re: M106 P0 controls D8, but D9 is always on
June 11, 2022 01:11AM
Firstly check the metal back plate of mosfets are not touching. This will interfere with their operation.

Secondly you connect a LED and a resistor to D9 on the mega and check it works with blink sketch (modified for pin D9) Ie [www.arduino.cc]
If this works then the D9 works (this is good, as D9 is directly off of the mega2560, and if that is bad you need a new mega to fix it)

If D9 is working it has to be the MOSFET

M106 only controls fans (or what ever you have attached to those pins) , ie FAN_PIN, FAN1_PIN, FAN2_PIN where P is the fan pin number
Re: M106 P0 controls D8, but D9 is always on
June 12, 2022 08:58PM
Actually managed to get laser working from D10, ignoring D9 completely (should get that checked though). For those looking for answers here, there was a simultaneous issue where I was running EFB instead of EFF, which meant that previously when I'd tried D10 nothing had happened since it wasn't a "fan" pin (as far as I understand the system) and compoiund that with the fact that I was trying to run it from M106 added to my confusion - didn't realise that M106 was fan only, thought it controlled the D pins in general.

Appreciate the help! Still issues, but a lot further along than before, thanks!
Sorry, only registered users may post in this forum.

Click here to login