5
\$\begingroup\$

I have an STM32F2 (reference manual here) which is connected to a GPS receiver through 5 pins. One of these pins is a power supply pin for the GPS.

All pins on the micro-controller are GPIO pins that need to be configured. (E.g. configure as input, output, floating, open-drain, push-pull, etc.) The ARM reference manual does not discuss GPIO pins as power sources.

What GPIO configurations do I need to apply to a power supply pin?

\$\endgroup\$
5
  • 3
    \$\begingroup\$ Check the power consumption of the GPS receiver, and the source capability of the GPIO pins. It probably won't be enough. \$\endgroup\$
    – clabacchio
    Commented Apr 27, 2012 at 9:39
  • 2
    \$\begingroup\$ If your load consumed only a bit more than what one GPIO pin is able to provide (with a usable voltage after the drop), and you were really really space constrained, you could tie N GPIO pins together, and drive them all equal, to sum their currents. I've done this for light loads, but a GPS receiver is not the case. \$\endgroup\$
    – Telaclavo
    Commented Apr 27, 2012 at 11:51
  • 2
    \$\begingroup\$ @Telaclavo, I've done this and it works, but be sure to check the microcontroller's maximum total current spec as well as the individual pin current spec. \$\endgroup\$
    – markrages
    Commented Apr 27, 2012 at 16:22
  • \$\begingroup\$ @markrages Sure, I always check that. \$\endgroup\$
    – Telaclavo
    Commented Apr 27, 2012 at 17:04
  • \$\begingroup\$ STM32 GPIO can only source 3mA max, if I'm not wrong \$\endgroup\$
    – Long Pham
    Commented Apr 8, 2018 at 11:26

2 Answers 2

11
\$\begingroup\$

Note:
This answer was originally written before we knew anything about the receiver, like its 1.8V power supply. Telaclavo's answer is good. As a more general answer the PNP/MOSFET solution remains; you don't want to power parts of your circuit from a microcontroller's I/O pin.

You don't want to do that! You'd configure the pin as output and make it high to provide power to the GPS receiver, but microcontrollers I/Os can only supply limited current, 25mA for the STM32F205xx (Section 6.2 page 72 of the datasheet), which will be too low for powering your (and any other) GPS receiver (34 to 38 mA, as stated in the datasheet)

Use the I/O pin to drive a PNP transistor which will supply the required current.

enter image description here

Note that using a PNP inverses your logic: a logic low will turn the receiver on.

I would not use an NPN for this. In common emitter it would mean that the receiver's ground is a few hundred mV above ground, and a circuit should have one single ground which is the same for every component. In common collector you would lose too much of your 3.3V power supply.

edit
Wouter would use a MOSFET instead of a BJT, and that's a good alternative. Just make sure you choose a logic-level FET, which will give you enough current at a \$V_{GS}\$ of -3.3V. The Rohm RZE002P02 is a suitable type. It will also have a lower voltage drop if your receiver needs less than about 200mA.

edit 2 (re clabacchio's addition of a datasheet)
This device operates at 1.8V, the STM32 at 3.3V. You can use an LDO with an enable input and control that from your microcontroller. No transistor needed. (Thanks for the suggestion, markrages.) You'll also need level shifters for the data.

\$\endgroup\$
14
  • 2
    \$\begingroup\$ If you have an LDO, the PNP/P-channel transistor is built-in. Just choose an LDO with an enable input and drive that with the micro. \$\endgroup\$
    – markrages
    Commented Apr 27, 2012 at 13:08
  • 1
    \$\begingroup\$ Any particular reason why you suggest a PNP over an NPN? \$\endgroup\$
    – Saad
    Commented Apr 27, 2012 at 13:17
  • 1
    \$\begingroup\$ Yes, is there a reason why it needs to be common emitter? \$\endgroup\$
    – Saad
    Commented Apr 27, 2012 at 13:36
  • 1
    \$\begingroup\$ @stevenvh Thanks. Just wanted to be sure - I'm just a newbie and I miss a lot of small things so I thought I had better ask if there is any difference. :) \$\endgroup\$
    – Saad
    Commented Apr 27, 2012 at 13:39
  • 1
    \$\begingroup\$ @Saad - come to think of it: in the common collector the output voltage at the emitter will be 0.7V lower than the base voltage, so you have a higher voltage drop, which also means higher dissipation in the transistor. \$\endgroup\$
    – stevenvh
    Commented Apr 27, 2012 at 13:52
3
\$\begingroup\$

In fact, now that I read the datasheet, it says clearly (in Note 1 of Table 3)

Note 1 of Table 3

So, you should not interrupt the power path to the GPS receiver, and instead do something like this:

Schematic

Note that, according to Table 6, the ON_OFF pin is 3.6 V tolerant. The GPS will be ON when that GPIO signal is high.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.