Author Topic: 5V powered master on an 3V3 I2C bus?  (Read 1833 times)

0 Members and 1 Guest are viewing this topic.

Offline Lovely_SantaTopic starter

  • Contributor
  • Posts: 42
  • Country: be
5V powered master on an 3V3 I2C bus?
« on: March 04, 2017, 08:47:45 pm »
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: myself
Lets not use the 5V, and make everything working on 3V3... saving some money, 1 less IC, more space, and no heatsink for that IC, thumbs up!  :-+

So, 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 datasheet
  • SCL/ADC5/PCINT13 – Port C, Bit 5
    SCL, 2-wire Serial Interface Clock: When the TWEN bit in TWCR is set (one) to enable the 2-wire Serial
    Interface, pin PC5 is disconnected from the port and becomes the Serial Clock I/O pin for the 2-wire Serial
    Interface. In this mode, there is a spike filter on the pin to suppress spikes shorter than 50 ns on the input signal,
    and the pin is driven by an open drain driver with slew-rate limitation.
    PC5 can also be used as ADC input Channel 5. Note that ADC input channel 5 uses digital power.
    PCINT13: Pin Change Interrupt source 13. The PC5 pin can serve as an external interrupt source.

  • SDA/ADC4/PCINT12 – Port C, Bit 4
    SDA, 2-wire Serial Interface Data: When the TWEN bit in TWCR is set (one) to enable the 2-wire Serial
    Interface, pin PC4 is disconnected from the port and becomes the Serial Data I/O pin for the 2-wire Serial
    Interface. In this mode, there is a spike filter on the pin to suppress spikes shorter than 50 ns on the input signal,
    and the pin is driven by an open drain driver with slew-rate limitation.
    PC4 can also be used as ADC input Channel 4. Note that ADC input channel 4 uses digital power.
    PCINT12: Pin Change Interrupt source 12. The PC4 pin can serve as an external interrupt source.

So 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 :palm:)

  • 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
English is only my 3th language, so don't tell me my english is bad, becose I know that, I try to do what I can...
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13125
Re: 5V powered master on an 3V3 I2C bus?
« Reply #1 on: March 04, 2017, 09:01:33 pm »
1. You generally have to use a level shifter. See https://www.adafruit.com/datasheets/an97055.pdf

2. 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.
 
The following users thanked this post: Lovely_Santa

Offline Lovely_SantaTopic starter

  • Contributor
  • Posts: 42
  • Country: be
Re: 5V powered master on an 3V3 I2C bus?
« Reply #2 on: March 04, 2017, 09:34:41 pm »
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  :-DMM
English is only my 3th language, so don't tell me my english is bad, becose I know that, I try to do what I can...
 

Offline cyberfish

  • Regular Contributor
  • *
  • Posts: 240
  • Country: gb
Re: 5V powered master on an 3V3 I2C bus?
« Reply #3 on: March 06, 2017, 11:06:00 pm »
  • 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 :palm:)

That 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.pdf

At 5V Vcc it's 0.6 * Vcc, or 3V. So it probably will work, but you don't have much noise margin.
« Last Edit: March 06, 2017, 11:07:50 pm by cyberfish »
 

Offline Lovely_SantaTopic starter

  • Contributor
  • Posts: 42
  • Country: be
Re: 5V powered master on an 3V3 I2C bus?
« Reply #4 on: March 07, 2017, 08:38:44 pm »
That 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.pdf

At 5V Vcc it's 0.6 * Vcc, or 3V. So it probably will work, but you don't have much noise margin.

Ian 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...
English is only my 3th language, so don't tell me my english is bad, becose I know that, I try to do what I can...
 

Offline flochlandla

  • Newbie
  • Posts: 6
  • Country: at
Re: 5V powered master on an 3V3 I2C bus?
« Reply #5 on: March 13, 2017, 10:48:22 am »
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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf