Computing stuff tied to the physical world

Power through I/O pins?

The MPS circuit includes Q3, a MOSFET which controls power to the RFM69, and which is in turn switched on or off by an I/O pin on the µC.

The RFM69 can be put into a very nice “idle” mode, which typically draws only 0.1 µA. So why not connect it to the same supply as the LPC810, and immediately put it to sleep?

The problem is the default mode in which the radio starts up, and timing:

  • on power-up, the RFM69 is designed to go into “standby” mode
  • this draws about 1.25 mA and activates the on-board 32 MHz crystal oscillator
  • this way, the radio module can be used as clock for a µC (initially at 1 MHz)

Once SPI access is possible, we can of course immediately put it into idle mode, but the harm will already have been done: the first 10 ms after power up, the radio will have entered its 1.25 ms energy “slurping” mode. Worse still, the LPC8xx series takes about 40..50 ms to start up, and until that process is done, we can’t put the radio to sleep.

Here is a capture which shows the radio’s clock starting up:

SCR82 1

The radio power is applied, and after about 6 milliseconds, the DIO5 pin bursts into action with a 1 MHz square wave coming out. Note that the lower half is zoomed in 2000-fold.

(please ignore the wavy lines at the top, these are oscilloscope sampling artefacts)

It’s a great feature for when you need it, but the effect is that on power up, our radio would be consuming 1.25 mA for at least 40 ms before we can put it to sleep. In the MPS, where microamps are the norm, this is not such a great idea. It would never get off the ground.

So instead, we’ll power up just the µC, put it to sleep a bit for the supply voltage to rise further, and then start up the radio when we have some energy to spare. After a 10 ms radio power-up delay, we set up SPI, connect, configure the radio, and put it into idle mode.

The power supply of the radio need never be shut off again, since idle mode is much more convenient: all radio settings are preserved, it responds immediately to commands, and we don’t ever have to jump through any power-cycling hoops again.

Back-feed power

As mentioned earlier, the unpowered radio is still not quite playing along. Here’s the first implementation, which started up, waited a bit, then turned on radio power:


First off: this is working code! The largest blips (there’s also a second one starting on the far right) are real radio packet transmissions taking place. This is as expected: power comes up, the supply voltage builds up, and occasionally the µC wakes up and sends out a packet – which causes a substantial-but-non-fatal power drop, after which everything goes back to sleep and the supply charges up again.

But there’s something very odd going on in the first second, and it’s causing the MPS to only work with a fairly large amount of incoming energy. So what’s going on here?

The initial small yellow blip is the µC coming out of reset. But for some reason, Vradio keeps on rising up to 1.22V – then it drops back a little and stays there, and at that point the Vres supply voltage quickly ceases to rise. The radio is eating up power – which is not really surprising, since it’s probably trying to start up, in that 1.25 mA mode.

Then, the µC wakes up and turns on Vradio power for real, which you can see with the blue line rapidly being raised to maximum. After that, the blue line (Vradio) is hidden behind the yellow one (Vres).

Darn diodes!

That 1.22V value is a hint – this is approximately the value of two diodes in series, when conducting, i.e. in “forward-biased” mode.

Here’s what’s going on: almost all I/O pins on digital chips nowadays have ESD protection diodes. CMOS logic is very high-impedance, and sensitive to high voltages. These diodes conduct any charge on those pins safely away to the supply and the ground rail, as follows:


(image from EETimes)

That circuit is inside the chip, and replicated for each I/O pin. If “+V” is not connected to anything, or at least not to a power supply, then you can think of any voltage on an I/O pin as being able to feed the V+ line instead. If you put 3V on the I/O pin, you’ll get ≈ 2.4V on V+ as a result. Which in turn reaches everything else connected to V+.

This is what happened above: at “X” V, the voltage on some SPI pin, ended up as “X-0.6” V on Vradio. The SPI pins are tied to the LPC810, which starts up with every I/O pin defined as an input plus a “weak” pullup, equivalent to about 50 kΩ tied to the LPC810’s supply.

Now as the supply voltage on the µC rises, so do all its I/O pins, unless told otherwise – but we can’t tell them otherwise until our main() code starts!

All in all, there seem to be three diode drops between Vres (the increasing supply voltage) and Vradio, fed through the µC, into the SPI I/O pins, then through the radio chip itself.

It doesn’t really matter where these diodes are, we simply can’t change this behaviour.

We can definitely not affect any of this before the µC has come out of reset, i.e. up to that first short dip. But the main problem is in fact later on – Vradio keeps on rising, because the SPI pins are back-feeding it long after the µC has started up.

As it turns out, we can reduce the problem substantially, allowing the MPS to work from a weaker energy source than above. So that will be the next challenge…

[Back to article index]