Welcome! Log In Create A New Profile

Advanced

Why is a pin set to HIGH on startup?

Posted by yello3d 
Why is a pin set to HIGH on startup?
January 18, 2023 02:59AM
I am still busy with the pins. I am using a pin from the LCD to switch a motor via Mosfet.

Pin is PA8 = P8
When I switch the machine ON the motor runs
I do: M42 P8 S0 - nothing happens, motor runs
I do: M42 P8 S255 - nothing happens, motor runs
I do: M42 P8 S0 - motor stop, and from now on works as expected.

My workaround is using a different pin (PC12 = P44) that works as expected.

I wonder why? I may changed a setting accidentally.
Re: Why is a pin set to HIGH on startup?
January 18, 2023 09:53AM
Try using M42 P8 S0 T1 for the initial command. This will set the pin as an output and then set the pin low.

As to why P44 acts differently than P8 ... I'm guessing that P44 is set to an output automatically by Marlin and P8 isn't. You can use the M43 command to see how the pins are setup. M43 is available when PINS_DEBUGGING is enabled.

You may want to add an M42 command to the STARTUP_COMMANDS script to set the power up state of the motor.
Re: Why is a pin set to HIGH on startup?
January 18, 2023 10:03PM
Thank you.

With M43 P8 is seen as OUTPUT and the others as INPUT

I added:

#define STARTUP_COMMANDS "M42 P8 S0 T1"
Re: Why is a pin set to HIGH on startup?
February 04, 2023 11:43AM
Could you please specify what board you are using? Sorry but I cannot help you improve Marlin or give you technical details if you are being this unspecific.


Martin Turski, company owner of EirDev

Support me in my duties! Improve the world through scientific accuracy and ingenuity.
Sorry, only registered users may post in this forum.

Click here to login