5V powered master on an 3V3 I2C bus? - Page 1
Forum section: electronics / projects

author: Lovely_Santa
author_rank: Contributor
timestamp: March 04, 2017, 08:47:45 pm
content: Hi,I was working on a cheaper power supply, based on Dave's -till today- unfinished µSupply.On the revC he isn't actualy using the 5V supply (it's only connected to the unused USB connector). So I was thinking:Quote from: myselfSo, my ATmega328P-PU is running at 8MHz, becose it's powered on 3V3... But then *a month later* I added a 5V regulator for 1 single chip i couln't find on 3V3... and started using it again for more and more... so now i'm thinking to set my atmega back to 5V, becose then I can have a 16MHz clock, so more computing power! (you never know what will happen)... But the problem is that all the other I2C devices are only working on 3V3.Then: "The datasheets are always your friend, so I found this in the ATmega datasheet (or is it a dataBOOK?I call 650+ pages a book...)Quote from: ATmega238p datasheetSo here are my questions:The internal pull-ups are disabled on I2C mode, so no worries there would be 5V on those pins, easy to connect 2 pull up resistors to 3V3. BUT: will the microcontroller be able to read 3V3 as a high input, or is that beneath the threshold? (looked for it for an hour, and ragequited)Anyone can give me an idea on the current demand of an "average" ATmega238p? like 10mA? 100mA? some 10mA's? I know that it depend on what it is driving, it's just if I have only my microcontroller (and some low power IC's) connected on my 5V regulator, should it need a heatsink?Thanks in advance for helping me out,Lovely_Santa

author: Ian.M
author_rank: Super Contributor
timestamp: March 04, 2017, 09:01:33 pm
content: 1. You generally have to use a level shifter. Seehttps://www.adafruit.com/datasheets/an97055.pdf2. The datasheet says an ATmega328P @8MHz, 5V, can consume up to 12mA. If you double that for 16MHz, it would be a safe upper limit. Don't forget to add any current sourced from high output pins.

author: Lovely_Santa
author_rank: Contributor
timestamp: March 04, 2017, 09:34:41 pm
content: Thanks to clear that up, I found the level shifter pro's and con's on the internet already (most the overshoot delay on falling edge is bugging me)... I'm still concidering only to use a level shifter to the 5V I2C components and get my atmega back to 3V3

author: cyberfish
author_rank: Regular Contributor
timestamp: March 06, 2017, 11:06:00 pm
content: Quote from: Lovely_Santa on March 04, 2017, 08:47:45 pmThat rating is usually called Vih (input high voltage). Sometimes it's a fraction of Vcc (eg. 0.7 * Vcc), and sometimes it's an absolute voltage.It's on page 365 here:http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdfAt 5V Vcc it's 0.6 * Vcc, or 3V. So it probably will work, but you don't have much noise margin.

author: Lovely_Santa
author_rank: Contributor
timestamp: March 07, 2017, 08:38:44 pm
content: Quote from: cyberfish on March 06, 2017, 11:06:00 pmIan said a level shifter to solve that, but there is some delay on the falling edge, and i'm routing my board atm, to see how long the bus will be, to see how capacitive it will be and how much this will decrease the performance...

author: flochlandla
author_rank: Newbie
timestamp: March 13, 2017, 10:48:22 am
content: Slightly off-topic, but seriously:Get rid of that ATMEGA model. A 5V supply just to run the system on 20MHz is not acceptable. If you should ever plan to run an application from a LiPo-battery you would need a step-up-converter.Just as an example (I'm currently stuck to TI): I use an MSP430F5438A at my current work (medical product) and that model allows operation at 24MHz at voltages down to 2.4V and code execution never requires more than 9mA - 4.5mA when executed from RAM.The MSP432P401R (Cortex-M4F) even goes down to 2V when operated at 48MHz.