Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Guidance: using 5V signals with pull-ups/pull-downs


  • Please log in to reply
6 replies to this topic

#1 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 February 2014 - 09:10 PM

Netduinos feature modern 32-bit microcontrollers running at 3.3V. To maximize the number of Arduino shields usable with Netduino, we use microcontrollers whose pins are 5V tolerant (when used as digital inputs).

We've been working with ST, analyzing their STM32 chips' circuitry--and also referencing datasheets from Atmel; during this work we uncovered some data on the micros regarding 5V tolerance in combination with internal pull-up/pull-down resistors. In the interests of providing you with not only the best gear--but also the best engineering guidance--I'm posting this appnote.

5V tolerant modes and 3.3V modes
All of the pins on your Netduino (D0-D13, A0-A5 and SDA-SCL) are 5V tolerant by default (i.e. as digital inputs with ResistorMode set to None). This covers most instances where 5V signal inputs are used, supports external 5V pull-ups, and provides backwards compatibility with older 5V Arduino shields.

The internal pull-ups/pull-downs that can be enabled within the pins, however, are not 5V tolerant. So enabling those internal resistors in conjunction with 5V inputs is not recommended and could damage the MCU. If you need pull-ups with 5V signals, use external 5V pull-up resistors instead.

In Summary
1. All IO pins are 5V tolerant by default--and also when used as InputPorts with ResistorMode set to None.
2. When enabling internal pull-ups/pull-downs on InputPorts, use 3.3V (or open drain) signals.
3. In cases where you need pull-ups/pull-downs on 5V signals, use external pull-up/pull-down resistors.
4. When using pins A0-A5 as AnalogInputs, the valid input range is 0.0V-3.3V.

We've added a note on pull-up/pull-down tolerance to the product specs pages, and ST has added a note to their STM32 datasheets. If you have any questions on 5V tolerance, just let us know.

Chris

#2 Frode

Frode

    Advanced Member

  • Members
  • PipPipPip
  • 202 posts
  • LocationNorway

Posted 04 February 2014 - 09:42 PM

Hi Chris, thanks for shedding some light on this. I'm currently on my third Netduino, and I suspect the two first ones were fried when I worked with 5V on the analog inputs.

 

If you have any plans for a newer version (dare I say Netduino 3?), it would be very much appreciated if the Netduino didn't die when we incorrectly use 5V on the inputs.



#3 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 04 February 2014 - 10:16 PM

Hi Frode, Thank you very much for your feedback. The simplest advice when creating custom circuits (i.e. not using shields) is to use 3.3V components. The 5V InputPort tolerance is mostly there for backwards compatibility with Arduino shields...and with the newer "R3" shields the IOREF has largely done away with the need for that. Still--we enable 5V tolerance because we believe that backwards compatibility is important. BTW, we've looked at including all sorts of extra-protection chips for super-super-toughness, but in the end we always come back to making the boards best-in-class and generally-worry-free...yet affordable. We do include a lot of nice protection parts on the board (like the USB ESD circuitry) but we want to avoid putting things between the MCU pins and your application which degrade accuracy or usability. Chris

#4 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 05 February 2014 - 05:33 AM

This is a very good post: I'd made as sticky on the top of the forum.

I also would call for improvements, because this is a long-time hot discussion.

 

What Chris pointed out is correct, but the possible "damage" is a little exaggerated. I am having some difficulty to find specs about ST (quite chaotic docs system), but the Atmel specs say clearly what happens.

 

 

=== INPUT ===

If you activate the pull-up, that is connected to the +3.3V. So, if you have an legacy-logic high-level (5V), there is a small current flowing through the pull-up resistor. That is a very low current: no damage at all, just a waste of energy.

In such a cases, agree, best disable the internal pull-up and use an external one to +5V.

 

One of most famous contexts is the I2C shared among legacy chips. Whereas possible, I'd use external pull-ups to +3.3V. External, because I may decide the best value upon the number of devices, their characteristics, etc.

Sometimes a more complex level translation adapter is needed.

 

 

=== OUTPUT ===

When the Netduino exposes an output to a legacy logic, the only problem is on the level acceptance of the logic itself. Most of the chips supplied at +5V considers "high" a level above +3.0V, so the +3.3V is fairly above the threshold.

No damage at all, no useless currents.

 

By the way, an output can be set as push-pull or as open-drain.

Push-pull is where the output is driven by two switches: to create a level high, a connection is made between the output and the power supply; when the output has to be low, the connection is toward ground.

The open-drain is simpler, because is just the "ground-switch" part of the push-pull.

http://digital.ni.co...6256FC1007947AA

If you wire together many open-drain outputs, there's no problem at all. This is the typical pattern used by the I2C: wired logic.

The problem of damage could arise by wiring together several push-pull outputs. When an output drives high and another low, the current flowing through can stress a lot the internal parts, and a overheat (even worse a damage) will result.

 

As for the ADC, nothing else to add: everything was explained by Chris.

 

These notes aren't new at all, and obviously lead you to take care about either the circuit and the software.
The problem is that sometime you may accidentally have a bug or misplaced a wire: that should not represent a critical problem for the entire board. In case of doubt, just add a low-value series resistor between the Netduino pin and your circuit (e.g. 200-500 Ohms): a such low value typically won't introduce any difference in term of functionality, rather helps to protect the parts upon an error.
 
Hope it helps.

Biggest fault of Netduino? It runs by electricity.

#5 wendo

wendo

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 05 February 2014 - 06:43 AM

When talking about wish list improvements for future versions my current list looks like this:

 

* Integrated pull up resisters on I2C pins, obviously there are issues here, but something as generic is possible would make life so much easier when using shields.

* Switch mode PSU on the barrel jack giving a much wider voltage input range without having to worry about temp. I'm talking about being able to use a typical laptop PSU for example (17-19v)

* 5v analogue inputs.... obviously this could even be a regression but there are a LOT of shields out there that run 5v analogue pins. A 12bit  ADC would still be nice, when I say 5v inputs, I mean not just 5v tolerant, but 4096 steps over 0-5v range

 

Lastly, NETMF 4.3 ;), not that Chris can do much regarding that one but it's getting ridiculous the amount of time it's taken.



#6 stotech

stotech

    Advanced Member

  • Members
  • PipPipPip
  • 143 posts
  • LocationAustralia

Posted 12 November 2014 - 04:05 AM

Yes, Yes Yes! I think this is my problem I keep having.

 

Is it only a problem if i enable the pullup on the specific pin with the 5v signal. As in,

 

If I use an internal pullup on a single pin that is attached to a 3.3v device.

Does this mean I can't attach a 5v device to a different pin and use an external pullup? Meaning that once the pull up is enabled on one pin, 5v is out for all other pins. Or is it just pin specific.

 

If that makes sense.

 

Thanks in advance.



#7 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 12 November 2014 - 05:31 AM

Hi Grant,

Is it only a problem if i enable the pullup on the specific pin with the 5v signal. As in,
If I use an internal pullup on a single pin that is attached to a 3.3v device.
Does this mean I can't attach a 5v device to a different pin and use an external pullup? Meaning that once the pull up is enabled on one pin, 5v is out for all other pins. Or is it just pin specific.

The guidance only applies to single pins. So you can safely use a 3.3V signal with internal pull-up on one pin while using 5V signals (with no pull-up) on another pin. The reason for this guidance is effectively because plugging a 5V signal into a 3.3V pull-up can cause voltage to effectively travel "backwards" into the 3.3V MCU power supply.

So as long as you're only using pull-ups/pull-downs on 3.3V pins you should be good to go. Feel free to mix in 5V logic on other pins.

Chris




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.