Wednesday, 25 March 2015

mosfet - Open collector microcontroller output


I am building the following circuit, in order to control the P channel MOSFET as a high side switch for my load.


The input of this circuit will be from a microcontroller (maybe an STM32F103), and I was planning to use the output pin, in open collector mode.



Will this work? Please note that I am pulling up the pin at 12V.


I know that in other circumstances it would work, but in a microcontroller, will the output handle the 12V? When in open collector, are the ESD diodes disconnected?


And if it works, how do you handle the initialization of the pin, (after reset, before configured as an open collector pin).


enter image description here



Answer



No, the ESD network is not disconnected. There are a very few micros that may have one pin or so that can be pulled up to a higher voltage than supply voltage (eg. RA4 on PIC16F7X, which can be pulled up to 12V absolute maximum), but generally you cannot do this without causing the ESD network to conduct (which you should avoid doing for several reasons, for here it will suffice to note that it won't work for you). Some newer micros may have special ESD networks to allow 5V inputs which allow the output to be pulled up to +5 even with a lower voltage supply, but I don't think an operating voltage of 12V is a reasonable expectation.


Just drive a small MOSFET or a BJT+base resistor with the GPIO push-pull and use that as your 'open drain'. You may even be able to find a dual n-channel/p-channel MOSFET that suits your purposes and keep the parts count identical (though I like the idea of a series resistor to the GPIO if possible, just because it could save the micro in case something shorts the 12V to the GPIO).


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...