My first STM32 circuit, is this Circuit ok?

Thread Starter

TerryGould1991

Joined Mar 18, 2016
9
Hi,
This is my first time working away from Arduino.

I am creating a simple CAN bus analyser using a STM32F105RBT6

I have used parts of circuits from various evaluation boards.

But I am mainly concerned about the Power circuit. I want to be able to power from VIN or USB. Both are to be able to be powered at the same time.

I have also seen similar circuits using a 8mhz or 25mhz so I am not sure which to use.

Will the attached circuit work?
 

Attachments

IMO, you have too many regulators. Do you actually use the +5V for anything in the circuit? If not, you don't need a precision switching regulator for +5V. It's a waste. And the extra regulator for a comparator reference and the comparator itself is a waste.

And also, there's nothing to prevent the USBVCC from feeding back into the switching regulator.

What I would do is feed the VIN supply through a good silicon diode to the switching regulator, and reset the FB for 3.3V operation.

Then connect up the source of your backwards PFET also to the input of the switching regulator, and connect the gate of the PFET back to the other side of the diode (at VIN). I think this will work. I haven't simulated it, maybe someone else will critique me. You'd also probably want a load resistor (say 100K) across VIN to pull the PFET gate down to ground when VIN is off.

The PFET gate will be driven higher than the source by 0.7V when VIN is on, which isn't conventional, but most PFETs can take it. Just make sure your VGS has +/- ratings.

But the way it's wired up, as long as VIN is 5.7V or higher, it should completely shut off the PFET and supply the circuit. If VIN is not lower than the VGS threshold below 5V, it'll shut off the PFET but not supply the circuit, so get a PFET with a relatively small gate threshold and make your VIN high enough to supply the circuit.

upload_2016-3-18_8-5-12.png
 

Alec_t

Joined Sep 17, 2013
14,280
Welcome to AAC!
I think you have FET T1 the wrong way round.
Simply wiring the two 5V supplies directly in parallel is not advisable. They will probably fight. Have you considered diode-OR-ing them?
 
BTW, the FDN340P is a nice PFET. It should work fine in the circuit I've drawn. It has a very low gate threshold (~1V) and the VGS is +/-8V which should be plenty.

Come to think of it, the gate threshold is so low (0.4V min, 0.8V typ) you might have to use a Schottky diode for D1. The drop across this diode might be enough to turn on the FDN340P. You may want to pick a PFET with a minimum VGS(th) of a couple of volts.
 
Alec, wiring a PFET backwards is a proven technique in this kind of switching. The body diode blocks backflow so in the circuit I drew above D1 blocks the backflow to the VIN and the PFET body diode blocks the backflow to USBVCC.

The body diode conducts the drain voltage to the source in order to achieve the gate threshold to turn it on.

Sorry I got your name wrong at first, Alec. I was in a hurry to get out the door this morning.
 
Last edited:
Here's a modification of my circuit above which should balance the gate and the source for the VGS(th) turn-on problem I noticed above (where the drop across D1 would turn on the PFET). I've omitted the decoupling capacitors for simplicity. You'll want the proper decoupling at the input of your regulator.

Oh, and if it wasn't clear, I was proposing you just use the single switching regulator wired for 3.3V operation, since it doesn't look like you actually need the 5V in your circuit. If you do need the 5V, then just juggle the position of the switching circuit below to after the 5V switcher and before the 3.3V LDO.

upload_2016-3-18_8-36-33.png
 

Thread Starter

TerryGould1991

Joined Mar 18, 2016
9
Thanks for your help!

You have said everything I was thinking, there is no need for me to have 5v so what you suggested is a good idea.

I'll edit my schematic and upload it, in the meantime is the rest of the circuit ok?
 
Don't know that much about the STM parts, and I don't know anything about the CAN bus chip or interface. The 10K pullup on the reset line looks a little low; I usually use at least 47K but I use smaller capacitors so it probably balances out. As long as you calculate the time constant and it's appropriate to the minimum power-on reset timings on the STM it'll be fine. You should go through the calculations because the reference designs, while a good guide, are not always correct or optimal.

For the crystal bypass capacitors, look up the crystal's required capacitance and then there's a formula online for calculating the parallel resonant capacitors. I forget what it is offhand. Google for crystal oscillator capacitors and you'll find it pretty quickly.

It's also good practice to have a serial ferrite bead on the USB power input.

What are the 10K resistors to ground on "PB2" and "BOOT0"?
 

Thread Starter

TerryGould1991

Joined Mar 18, 2016
9
I have now up dated my schematic to reflect the power supply changes.

The PB2 is BOOT1 they both need pulling to GND through a 10k according to ST reference designs and application notes. Also according to the data sheet I shouldn't need a pullup on the reset line but on some evaluation boards there is an external 10k.

Heres my updated power supply circuit, there is nothing else USBVIN comes straight from the socket, the only thing missing is a capacitor on the USBVIN line.
 

Attachments

Thread Starter

TerryGould1991

Joined Mar 18, 2016
9
Anyone? I don't know how to go about calculating the maximum voltage I can apply to the gate as the FET isn't being used in a 'normal' application.
 

Thread Starter

TerryGould1991

Joined Mar 18, 2016
9
Surely if VIN is 30v and USB is 5V then the source would be 30v? Would that mean it would be ok?

If not what could I do to either prevent the mosfet from being damaged or an alternative circuit to switch the supplies?
 
Top