Forum > Embedded - AVR
connect 1 rasbperry to 2 atmega328P
pascalbythree:
Still working on my system, does anybody know if it is possible to connect 1 rasbperry to 2 atmega328P mcu's ? at all ?
I2C RPI as master, I2C AVR as slave.
Is this possible with this class framework?
https://github.com/ccrause/fpc-avr
i2cslavedemo.pp
https://github.com/ccrause/rpiplc_pas
Curt Carpenter:
I don't know, but it's more fun to bit bang it anyway :)
ccrause:
Yes. I2C is a bus protocol which allows several devices to intercommunicate. It would be best if both the RPi and 328's operate at the same voltage (3.3V), however this is not necessary. Connect the pullups to the RPi 3.3V. Picking the correct pullup resistors is somewhat important, typically 2 - 4.7 kOhm should work.
You can get more details on I2C in the I2C specification and user manual.
PS: Remember to use different slave addresses for the 328s
VisualLab:
--- Quote from: ccrause on February 09, 2024, 05:03:27 pm ---Yes. I2C is a bus protocol which allows several devices to intercommunicate. It would be best if both the RPi and 328's operate at the same voltage (3.3V), however this is not necessary. Connect the pullups to the RPi 3.3V. Picking the correct pullup resistors is somewhat important, typically 2 - 4.7 kOhm should work.
You can get more details on I2C in the I2C specification and user manual.
PS: Remember to use different slave addresses for the 328s
--- End quote ---
You could use some small logic level translator module.
ccrause:
--- Quote from: VisualLab on February 10, 2024, 12:50:12 am ---
--- Quote from: ccrause on February 09, 2024, 05:03:27 pm ---Yes. I2C is a bus protocol which allows several devices to intercommunicate. It would be best if both the RPi and 328's operate at the same voltage (3.3V), however this is not necessary. Connect the pullups to the RPi 3.3V. Picking the correct pullup resistors is somewhat important, typically 2 - 4.7 kOhm should work.
You can get more details on I2C in the I2C specification and user manual.
PS: Remember to use different slave addresses for the 328s
--- End quote ---
You could use some small logic level translator module.
--- End quote ---
The input voltage high threshold for digital I/O pins on the m328p running at 5V is ~ 2.6 V. Thus running the I2C bus at 3.3V is within specification even if the m328p itself is running at 5V. So a level shifter is not strictly required. Having said that, if the m328p I2C pins are accidentally switched high while connected to a 3.3V RPi it may overload the input pins of the RPi. As a safety precaution either include series resistors on the I2C lines (as suggested in the I2C manual), or use a voltage level shifter as suggested by VisualLab.
Navigation
[0] Message Index
[#] Next page