SPLat Logo

Understanding EC1 digital outputs

NOTICE: We are updating our website. For product enquiries and orders please contact us directly.
NOTICE: SPLat Controls has moved. We are now at 1/85 Brunel Rd, Seaford, 3198. map

In this EasyStep you will discover the basic electrical characteristics of the EC1's digital outputs. This is a highly condensed extract from the official data sheet of the STM32F372CC chip - about 5 pages' worth of it. This applies to all digital outputs, which includes the PWM outputs.

Expert summary

Close

A digital output is a pin that switches either to (close to) 0V (the negative supply) or (close to) the positive supply voltage, which in the EC1 is 3.3V nominal. We call these voltage levels "low" and "high" respectively. In the EC1 a digital output is low when it is set OFF by your program, and high when it is set ON (except outputs 0 and 1, the onboard LEDs, are the other way around). This is the opposite of the inputs. We made it this way because you are most likely to want to drive an NPN transistor off an output, in which case "active high" is the most useful.

Confused about "0V", "common", "gnd"? Click here to see some common terminology.

If your background is not in the electronics field, we may confuse you a bit with the way we refer to power supply pins, grounds, "common" terminals etc. In electronics we generally quote all voltages in relation to an assumed common or reference terminal. That common terminal is often called "ground", "gnd" or "circuit ground". It may or may not actually be tied to a physical ground point, for instance mains power supply earth.

In SPLat boards we usually label the "ground" terminal "0V". On boards that are powered off an external DC power supply (which is most off-the-shelf boards), 0V is the terminal connected to the negative terminal of the power supply. Measured relative to that pin, therefore, the positive power supply pin will be 24V (or 12V or whatever the supply voltage is) positive. We then say "we have a +12V supply". All boards contain a voltage regulator chip to feed the microprocessor and/or other logic chips. In the EC1 this chip generates 3.3V nominal (many other boards use 5V). Its output voltage is said to be +3.3V, again measured relative to the 0V terminal.

Similarly, all input and output voltages are also measured relative to the 0V terminal, and will in virtually all cases be positive voltages. For example, on most SPLat models the input voltage threshold for digital inputs, and analog input and output voltages, are measured relative to 0V.

Sourcing and sinking.

Normally, a "load" will be connected between an EC1 output and the 0V rail. A load is whatever connects to the output and gets "driven" by the output in order to do something useful. If the output is low, both ends of the load will be at the same voltage, and no current will flow. If the output goes high, positive current will flow out of the EC1 pin, through the load and into the 0V rail. This is what we call sourcing. The EC1 is sourcing current for the load.

(We always think in terms of positive current flow in electronics. With all respect to electrons, that is the convention.)

If we reverse the situation, and connect the load between the EC1 output and the positive supply rail, current will flow only when the EC1 output is low. Because the (positive) current is flowing into the EC1 pin, we say the EC1 is sinking current.

But there are limits...

The outputs of the EC1 are formed from microscopically small transistors inside the processor chip. These transistors have limits on what they can do. The main limits are these:

Clearly, the pins are not designed to drive heavy loads. You could get away with an LED at 5mA, but you won't be able to directly drive a motor that requires 500mA. As a rule of thumb, worry if you want more than 5mA, and go to 20mA only if you understand what you are doing.

.... And there are exceptions (the onboard LEDs)

Outputs 0 and 1 (pins 29 and 28 of the EC1) drive the onboard red and green LEDs. That means 3 things:

  1. The logic sense of these two pins is opposite to all the others. They are low when ON. That's just how we made the board - electronics designers have a predilection for active low circuits;
  2. We have already "used up" about 8mA of the chip's sinking capacity on each LED;
  3. At reset the pin will behave like 220Ω pulled up to about 2V.
So on those two pins, the low (on) voltage will be about 400mV before it sinks anything from your external circuitry.

Reset behaviour (advanced)

When the processor chip is fully reset, either at power on or by a hardware reset, all I/O pins go first to a high resistance state. Once the firmware gets going they are configured as outputs and set low.

If you are driving a bipolar NPN transistor through a base resistor, there should be no transient turn-on "glitch". If, however, you are driving the gate of an FET, there can be no such guarantee. If this is a problem use a 10K pulldown resistor on the gate.

On a soft reset, i.e. when the SPLat program starts, all outputs are automatically switch to the off state.

Some interesting ways to blow up your EC1

If you want to blow up your EC1, and void the warranty, here are some things you can do to the outputs: