Arduino/Teensy + I2C

Plocploc

22 Apr 2013, 11:41

Hello,

I've just got a Teensy 2.0 and a keypad PCB that outputs I2C. Since I2C only uses 2 pins (SCL1 and SDA1) and of course 5V+ground, I was wondering whether I had to wire (or ground?) all the other Teensy pins also. Or can I leave them unwired?
Thank you in advance.

User avatar
Soarer

22 Apr 2013, 12:52

You can just leave the rest unwired :)

User avatar
kps

22 Apr 2013, 17:59

You should set the unused pins to inputs and enable the internal pullups.

Plocploc

22 Apr 2013, 21:00

Thank you for your advices :) Will do that

User avatar
Soarer

22 Apr 2013, 21:27

I've never bothered setting unused pins to have the pull-up turned on :D The default is input anyway, and enabling pull-ups only helps to reduce power (not really relevant unless using the sleep modes).

User avatar
hasu

23 Apr 2013, 05:12

How to do with unused pins always intrigues me.

To avoid damaging pin what should I do? I'd mean latchup with 'damage' here. Accidental shout circuit with VCC or GND lines causes damage on port, right? Hi-Z seems to be safe option for this purpose to me, though I have almost zero EE knowledge. If I can understand correctly Hi-Z pin draw/drains only very very few current.

EDIT: I'd mean Hi-Z is a safe option if you leave pins open unwired. Externally pulled down/up pins are more safe, right? And then which pin state should I use when pins are pulled up/down externally? Sorry for many many questions :D

And some document of power saving recommends pins are externally pulled up or down with resistors. I'm not sure how this works. Why does this contribute to power saving? and does AVR internal pullup also works for this purpose?

AVR pin states:

Code: Select all

    DDR PORT State
    -------------------------------------------
    0      0        Input(Hi-Z)
    0      1        Input with pullup
    1      0        Output Low
    1      1        Output High

User avatar
hasu

23 Apr 2013, 05:55

I was too lazy to even see datasheet :(

Atmel recomends unused pins should be internal pull-up unless you use external pull-up/down resistors. This seems to be mainly for power saving.

My questions still aren't answered completely. Now, "This also works for avoiding damage of pin like latchup?"

ATmega32u4 datasheet says:
10.2.6 Unconnected Pins
If some pins are unused, it is recommended to ensure that these pins have a defined level. Even
though most of the digital inputs are disabled in the deep sleep modes as described above, float-
ing inputs should be avoided to reduce current consumption in all other modes where the digital
inputs are enabled (Reset, Active mode and Idle mode).
The simplest method to ensure a defined level of an unused pin, is to enable the internal pull-up.
In this case, the pull-up will be disabled during reset. If low power consumption during reset is
important, it is recommended to use an external pull-up or pull-down. Connecting unused pins
directly to VCC or GND is not recommended, since this may cause excessive currents if the pin is
accidentally configured as an output.

User avatar
Soarer

23 Apr 2013, 14:19

I don't know if latchup (as described here) is a concern with AVR and I suspect it isn't, but certainly a pin that is set to output high or low can be easily damaged if the opposite voltage is applied to it with no current limiting.

User avatar
hasu

23 Apr 2013, 15:46

Thanks.
Yeah, latch-up might be misuse in this context and I don't understand it at all, my main concern is how can we avoid destructing open unused I/O ports. I usually left my Teensy pins open and it has no enclosure so completely exposure on my messy desktop.

As you mentioned, Output states will be dangerous for open pins. When I destroyed a port accidentally, state of the port was probably output. I'll keep my open pins Hi-z until I get clear answer or better solution.

Post Reply

Return to “Workshop”