I2C or serial communication between TWO atmegas of 3.3V and 5.0V

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I am trying to see if there are potential issue of having two atmegas, one run at 3.3V and one at 5.0V, communicating to each other via serial or I2 communication due to their operating at different voltages.  Also, one will run at 20Mhz (the 5V one) and the other at 16Mhz (the 3.3V one).

 

Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

USART: For the 5V>3.3V leg a simple resistor divider will work, 3.3V>5V leg MAY/SHOULD work.

I2C: Voltage translator circuit would be most reliable (chip or discrete part)

 

However this may be OK for one off but I would use voltage translator chip for production.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Put a resistor between. Not too small, though, because you will supply current into 3.3V device.

Try 1k, and mind: it deteriorates I2C speed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would question the decision to operate the two AVR's at different voltages, is it REALLY necessary?  

You can use voltage level translation, but it just adds complexity that may not be needed...

So ask why use two different voltages!   There may be a valid reason, by the way IIRC, max speed for 3.3v is 12MHz or so....

 

Flyover Jim

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The 3.3V MCU is used to interface with the SD card.  I am trying to see, as mentioned the original post, if I can avoid a voltage divider circuitry or a level shifter chip.  No, I am not trying to make it more complicated than it needs to be.  Looks like from the responses, the least I need to do is a voltage divider on the SPI (master to slave) pins.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


js wrote:
USART: For the 5V>3.3V leg a simple resistor divider will work,
Schottky diode is faster.

Planet Analog - SIGNAL CHAIN BASICS #66: How to interface a 5V transceiver to a 3V controller -

[1/3 page]

[bus idle]

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


grohote wrote:
Put a resistor between.
May cause a subtle over-voltage due to fast though finite speed of the ESD suppressors.

Planet Analog - SIGNAL CHAIN BASICS #66: How to interface a 5V transceiver to a 3V controller -

[3/4 page]

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


2-bit (I2C or AVR TWI) and 4-bit (SPI) level translators are small, fast, and nearly ubiquitous.

Active bus pull increases speed.

NLSX4373: Level Translator, 2-Bit, 20 Mbps, Dual-Supply (onsemi, datasheet page 3)

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've been up against this before and, for me, the best and simplest way to solve it is to install a TCA9548A I2C multiplexer chip or module board between the master at 5V and any slaves that are at 3.3v.

 

If you don't isolate the 5 and 3.3v systems, then when the slave asserts SDA or SCL, the assertion voltage (that is seen by the master) will only go down to 1.7v  (5- 3.3), which is not low enough to be considered a valid assertion.   You get invalid data or random lockups.

 

I agree that you should operate everything at 3.3V.  If you have something old that has to be powered at 5v (or more), then get a DC-DC switching converter board for few dollars on eBay.  Or, use a common 5V telephone power supply for the old component, then use a LDO Voltage regulator like AMS1117-3.3 to power everything else.

Last Edited: Mon. Aug 1, 2022 - 11:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1



The 3.3V MCU is used to interface with the SD card

You don't really need a 2nd chip then, unless you want to free the main chip by letting the 2nd chip talk to the card.

 

For all is worth this is what I did a few year ago when I was messing around with SD card, everything was handled by the one cpu.

 

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

js wrote:

The 3.3V MCU is used to interface with the SD card

You don't really need a 2nd chip then, unless you want to free the main chip by letting the 2nd chip talk to the card.

 

For all is worth this is what I did a few year ago when I was messing around with SD card, everything was handled by the one cpu.

 

 

Thank you all for the responses.  I've decided to have 5V for both MCUs, and put appropriate ressistors (1% ones 1K in parallel with 2K) on the masters MISO/CLK/CS lines, so that the SD card won't get fried.

 

@js thanks for the schematic.  Out of curiousity, I have two questions on the above schematic:

 

1) Does the MISO line really needs the 5V pullup via the 3K3 with Q1.  That looks esoteric :-)

 

2) The CD1 line has a 1K (R9) and 100nF (C3) to have it pulled down to GND, so that the card is detected?  Is the MCU side supposed to output a LOW signal to the CD pin to make sure the SD card is deteced. I could never understand the CD line in some SD card connectors.

 

Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

1) Yes, to be sure, maybe the internal pull up in MISO up MAY work, the circuit is a simple "common base" level shifter.  A FET maybe better but the transistor works.

 

2) CD1 is switched by a mechanical switch when the card is inserted IIRC. The internal pull up on the pin should be enabled, the capacitor is there to suppress noise when the card is not mounted and the input is high impedance.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The AVR_DB series micros can run on dual voltages, 3 and 5, each powering part of the chip, with the level conversions handled within the micro for you.

 

That makes driving a 3V peripheral from a 5V system trivial, (or vice versa).

 

JC