Go Down

Topic: 1602 (5v) LCD Display on Due (3.3v) (Read 6974 times) previous topic - next topic

MrAl

Hello there,

Did anyone get a 1602 LED display operating at 5v running on the Due which operates with a 3.3v power supply?

I was thinking of using one of those bi-directional  logic level converters that use MOSFET transistors that provide logic level conversion.
However, i ran into a possible issue where if there is a buss contention at any time (such as during start up when things are not as well defined as when normal operating takes place) or even a glitch in the code that means the ARM chip will have to absorb some energy from either the +5v system or the ground.

For example, if there is an I2C chip connected to the ARM chip when the I2C chip provides the "ACK" signal back to the ARM I2C pin (the data pin) it provides a logical "LOW" which is near zero volts (about 0.5 due to the series Schottky diode).  Now if the ARM happens to be outputting a +3.3v signal at that time, there will be a lot of current coming out of the pin.  This means a series resistor would be a good idea.

But the main question is, did anyone get a 1602 display up and running with the Due, and if so, what technique was used?

Thank you.

RayLivingston

Just put series resistors on the I2C lines.  330 ohms works well.

Regards,
Ray L.

MrAl

Hi Ray,


You mean you did not have to use a logic level translator (shifter) at all, just one 330 ohm resistor in series with each lead?

RayLivingston

Correct.  All you have to do is limit the current flow into the Dues I/O pins to a safe value for the ESD diodes.  For a 5V peripheral, 330-470 ohms does the trick.

Regards,
Ray L.

MrAl

Correct.  All you have to do is limit the current flow into the Dues I/O pins to a safe value for the ESD diodes.  For a 5V peripheral, 330-470 ohms does the trick.

Regards,
Ray L.
Hi again Ray,


Thanks.  Can i ask how you knew it was 330 to 470 ohms and not say 220 or 1000 ohms?
Thanks again...

RayLivingston

Didn't we beat that to death about a week ago?  It is based on the specs for the SAM3X, and the recommendation came from an Atmel engineer on one of their forums.  Any value that keeps the max voltage on the pin below 3.6V is fine.

Regards,
Ray L.

MrAl

Didn't we beat that to death about a week ago?  It is based on the specs for the SAM3X, and the recommendation came from an Atmel engineer on one of their forums.  Any value that keeps the max voltage on the pin below 3.6V is fine.

Regards,
Ray L.
Hello Ray,

Ok but how did you determine that 330 ohms kept the voltage below 3.6v, did you test it, and if so, how did you set up the test?

I ask because a current limiting resistor also limits the current into the pin, and with a high input impedance pin the only thing left is the ESD diode, and they dont publish the spec's for the ESD diode.
So theoretically, there is no resistor value that will prevent the voltage from going over 3.6v if driven at the other end of the series resistor with +5vdc.  It must be the ESD diode that clamps the current to +3.3v and that means that the diode has to conduct, and that means we have to know the rating of the ESD diode.
Do you happen to know the spec's of the ESD diode (especially the upper one)?

Do you follow this line of reasoning?

Thanks...

david_prentice

If you are talking about an I2C interface,   the pins are never driven high.    They are simply pulled high by the 4k7 external pull-up resistors.    Or "sunk" low by the open-drain outputs of your AVR / ARM.

Yes,    the 4k7 will pass some current through the substrate diodes because the "top end" is at 5V.    With 4k7,   this will be about 360uA.

With a 3.3V system,   it will be common to use 2k7 pull-ups to 3.3V.   Even if you have a mixture of 3.3V and 5V I2C slaves,  the bus lines are never going to cause any harm.

Of course,   it is a different matter if you connect your Due directly to a 5V AVR and drive the AVR output high and the ARM output high.    You will pass a large current through the substrate diode which will be harmful.  With Ray's 300R series resistor,  you will be passing 6mA.    This is unwise (tm) but you will just get away with it on one pin.   

The PCF8574 in your I2C adapter is not capable of driving I2C lines high.    So I do not see a problem.

David.

MrAl

If you are talking about an I2C interface,   the pins are never driven high.    They are simply pulled high by the 4k7 external pull-up resistors.    Or "sunk" low by the open-drain outputs of your AVR / ARM.

Yes,    the 4k7 will pass some current through the substrate diodes because the "top end" is at 5V.    With 4k7,   this will be about 360uA.

With a 3.3V system,   it will be common to use 2k7 pull-ups to 3.3V.   Even if you have a mixture of 3.3V and 5V I2C slaves,  the bus lines are never going to cause any harm.

Of course,   it is a different matter if you connect your Due directly to a 5V AVR and drive the AVR output high and the ARM output high.    You will pass a large current through the substrate diode which will be harmful.  With Ray's 300R series resistor,  you will be passing 6mA.    This is unwise (tm) but you will just get away with it on one pin.   

The PCF8574 in your I2C adapter is not capable of driving I2C lines high.    So I do not see a problem.

David.
Hello David,


Thanks for the info.

Yes i agree that during "normal" operation there should not be a problem.  But there is a case where there 'could' be a problem.  I dont want to have to come up with every possible scenario, but here is one.  The user inadvertently programs the pin as an output, and it is driven high, or the user wants to big bang the I2C connection.  If the pin is driven high when the 8574 chip is trying to deliver an acknowledge signal, we end up with a low impedance +3.3v output from the ARM chip and a low impedance ground (0v) from the 8574 chip, which causes a large current to flow in the diode in the ARM chip.

But this isnt the only possible error that could come up, i just wanted to illustrate what could happen with at least one example.

The information we would need then is how much current can the diode really take.  It would be good to know the continuous current rating like they publish for many of the PIC line of chips.  They state 20ma for those chips right on the data sheet.  If we design for 10ma we should get by.  Note however that for the 8574 chip this rating is also given but is only 400ua.  So that is how much they can differ.
So for the Atmel chip(s) is it, 20ma, 10ma, 5ma, 1ma, 500ua, 100ua, 10ua, 1ua, 10pa, 10fa, etc.? We dont know do we?

david_prentice

#9
Nov 08, 2015, 09:05 am Last Edit: Nov 08, 2015, 10:24 am by david_prentice
These are two different current paths.  

A 5V output connected to an ARM input will cause a current flow through the VCC substrate diode.    A 5V high output directly connected to a 3.3V high ARM output will cause a real problem and is likely to back-power the ARM.

A high output connected to a low output is a different path.    The VCC substrate diode is not involved.   You just have a large current being sourced by the "high" and sunk by the "low" pin.     The "battle" will end up with the pins somewhere between high and low.   The current will be large but the voltage limits will not be exceeded.  

I am not at a PC.    I doubt if the 8574 will sink a very high current on its I2C lines even if you drive one high by bit-banging.    Proper I2C operation never produces this situation.    I will check the values from the data sheet.    Let's face it.    The average Due owner is less likely to abuse her board than the average AVR user.   The I2C pins are less likely to be used for GPIO on a Due.


Edit.   I just looked at the PCF8574, 24LC1025, AT24C01/02/04/08/16 data sheets.   None of them specify how much current their SDA, SCL lines will sink.    I guess that they assume you are using the pull-ups from the I2C-spec  e.g. 3mA max. 

From your 'other' thread.    Yes,  you could simply measure the currents and voltages on Due pins when you connect to over-voltage and under-voltage.   Make sure that you alter the voltages gradually and stop when the data sheet limits are met.

I note that you mention PIC a lot.   Both PIC and AVR have high current output drivers and are generally more robust than an ARM.    You can damage them by over voltage and under voltage too.
Your I2C adapter is not a problem.
 
David.

MrAl

Hi again David,


Thanks for that extra info.  I am just starting to use the ARM chip so i want to know what it can take and what it cant take, so i know how to use it effectively in the future.  This means my quest is not limited to just the I2C and display, but i thought that would be a good place to start because that is what i have to do next.
I also got one of those bidirectional logic level converters that you may have seen, with the four mosfet transistors and two 10k pullup resistors per mosfet, which give me four level shifting channels, all bidirectional.
Before i used it however i wanted to clear up the pin current issue with the esd diodes, so i know what would happen if one of the mosfet transistors blew short (always a failure mode possibility).  A protection resistor would help here if we knew what current the esd diodes could take.  This is why i mentioned there are a lot of scenarios requiring this kind of technical knowledge, or lack of it.

What bothered me most was that the PIC chips seem to be very well specified, at least the ones i worked with but i havent checked all of them though.  I mention PIC a lot because i worked with them exclusively up to the point where i started working with various AVR chips and now finally the ARM.  Most of the stuff i worked with before that were all 5 volt systems like the 8080, Z80, Intel 386, 486, etc., so the level difference never really came up before now.  Since the PIC chips are specified as to the max diode current, that makes this part of the design interfacing much quicker.  I've spent days on this issue already and have not gotten a really definitive answer, something that is clearly shown on the PIC chip data sheet.
I inquired with ARM and they dont know, Atmel states that they dont provide that information :-)
Atmel just mentions the 2kv esd strike typical test as being acceptable.

So it is starting to look like i'll just have to wing it and try some stuff out, and yes, maybe do that more comprehensive test on each pin type.  In the mean time if you can find any more info, that would be nice to hear too.

Thanks again for looking into this.

Vaclav

The user inadvertently programs the pin as an output, and it is driven high, or the user wants to big bang the I2C connection.

Please explain how "user" can do that?

Maybe you are talking about the  programmer, right?

MrAl

The user inadvertently programs the pin as an output, and it is driven high, or the user wants to big bang the I2C connection.

Please explain how "user" can do that?

Maybe you are talking about the  programmer, right?

Hi,

Yes sure, if the user can 'program' then the user must be the programmer :-)

BTW i meant "bit bang" not "big bang" (ha ha) as that was a little typo.

bbx10node

https://www.pjrc.com/teensy/td_libs_LiquidCrystal.html

I used this library to get 5V displays running on the ESP8266 and Teensy 3.1 (both 3.3V systems).  This library uses the 16 pin Hitachi HD44780 compatible interface. 6 or 7 (fast mode) pins required.

Go Up