3
\$\begingroup\$

For my projects next revision, I'd like to drop the ULN2803A transistor array I currently use to drive eight optocouplers. Using optocouplers with a lower current requirement means that I'd only need to sink / source 5 mA of current for each of the eight pins.

Unfortunately, neither the datasheet for the MCU nor the specs of the development board include a rating I'm used to - like the 40 mA per I/O pin limit on the ATmega328P.

Table 12 of the datasheet (1) contains a formula for some Imax;

Imax = N x C x V x (0.5 x F)

where F is the "Data change rate" in Hz - but I believe that would imply I couldn't supply any current if the outputs were static, which is probably not the case.

What currents can this MCU sink / source? How do I calculate that? Can I (safely) drive eight 5 mA optocouplers directly via the MCU?

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

I think you are misinterpreting the datasheet. That Imax is how much current the GPIO is consuming. Because it's CMOS based DC current is negligible. Higher data rates increase current consumption.

I looked through the datasheet and did not find an absolute max GPIO output current. For what it's worth tables 26/27 mentions GPIO output impedance.

\$\endgroup\$
2
  • \$\begingroup\$ That sounds a lot more reasonable. I suppose I'd want to set the drive strength to its maximum for the optocoupler pins and then use a current limiting resistors as Rled = ((3.3V - Vf) / If) - Rdrv? \$\endgroup\$
    – towe
    Jun 19, 2020 at 6:51
  • \$\begingroup\$ That seems like a sound idea. For 5mA the ~23Ω of output resistance shouldn't muck with the resistor sizing too much (would give 4.8mA instead of 5mA assuming 1.15V forward voltage drop, 3.3V GPIO output, and 23Ω output impedance). Taking into account the output resistance results in closer actual output to the target 5mA. \$\endgroup\$ Jun 19, 2020 at 7:35
1
\$\begingroup\$

There's no single answer to this. That's why NXP doesn't state it explicitly in the datasheet.

Maximum output current depends on several factors:

  1. IO drive strength (DSE) with value range: 001,010,011,100,101,110,111
  2. Operating voltage
  3. Slew rate, fast or slow

The easiest way is to use GPIO output buffer avg impedance from the datasheet to calculate maximum possible current the pin could drive (See Warning below).

See the table below, let's assume you're working on 3.3v with max drive strength (111). So you have maximum current = 3.3v/23 Ohm = 143.5mA. But this is just a coarse value.

drive strength

The better way to know it is to read the I-V Curve from their IBIS Model. The curve below is taken from the RT1060 series IBIS Model. ~92mA max current @ 3.3v.

ibis model curve

Warning

just because you can doesn't mean you should. Now, although you can drive 90mA, the real question is for how long? some IBIS Model includes data outside its absolute rating. So, maybe you could drive 90mA, but only, for example, 30 nanoseconds.

Also, you may drive 90mA longer, but you need to keep the chip cool enough so it won't fry itself. In this case, max current is correlated with your ability to keep the Junction Temperature low.

Finally, the general recommendation from NXP is this: use buffer (transistor, etc) to drive your load. Don't drive high power load with GPIO pins.

i.MX RT1062 is a Crossover Processor from NXP, meaning that this is actually a microprocessor equipped with peripherals, not an MCU with super-high performance. Being a microprocessor, the Crossover processor doesn't have the strength like MCUs have.

\$\endgroup\$
1
  • \$\begingroup\$ Very nice, thank you! I believe that I-V curve is what I was missing. Judging from it, I suppose 5 mA for a maximum of 25 us, 50% duty cycle should be fine - I'll see when I try it out. \$\endgroup\$
    – towe
    Jun 19, 2020 at 12:51

Your Answer

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

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