Welcome! Log In Create A New Profile

Advanced

Marlin 2.0.X > Setting output pins as open collector

Posted by Hobi 
Marlin 2.0.X > Setting output pins as open collector
April 17, 2019 08:21PM
Hi All,

I am about to finish a port of Marlin to Alfawise U20, and I have still a small problem.

Heater control pins are driving mosfets, and I need to have an open collector output pin on the STM32 CPU.

Is there any specific Marlin way of setting a pin as Open drain / Open collector? Or we have to dive in the code for that?

Please advise.
Re: Marlin 2.0.X > Setting output pins as open collector
April 17, 2019 09:20PM
not that I have seen..

only thing close is the macros

#define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW)
#define SET_PWM(IO) pinMode(IO, PWM)

So easy enough to add your own but using OUTPUT_OPEN_DRAIN or PWM_OPEN_DRAIN
Re: Marlin 2.0.X > Setting output pins as open collector
April 18, 2019 01:10PM
You could use an NPN (or N-channel MOSFET - better still) to provide open collector from any CPU output if need be.

Scuse the quick and messy drawing ..


Sorry, only registered users may post in this forum.

Click here to login