Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8041

Interfacing (DSI, CSI, I2C, etc.) • Re: communication between 3 raspberry pi zero 2w

$
0
0
Do you think I²C is a reasonable choice for connecting 3 Raspberry Pi Zero 2W devices like this?
In a word: no.

The problem here is that I²C is a synchronous bus. The bus master drives a clock, and slaves that must respond according to the master's timing.

There are many reasons why a Raspberry Pi running a non-realtime kernel might not be able to support the timing requirements of synchronous interfaces. Maybe the CPU was busy and your process didn't get scheduled. Maybe your process' memory got swapped to a slow SD card and can't be brought back in time.

Interrupts are good for signaling that data is ready, but they still don't provide an I²C slave interface.

I would say that while your application is defined with masters and slaves, your communication bus should not. Ethernet, and it's derivatives, are fine choices. It's perfectly reasonable to use TCP/IP networking to transmit a few bytes. Or a lot of bytes, for that matter.

If you're concerned that full TCP/IP network is not appropriate, I do sympathize. There are all kinds of potential drama around crowded airwaves, access points, pre-shared keys, dynamic IP addressing, unauthorized access, etc.

If you want something leaner and more hardware-ish, you might look into multiple-access asynchronous serial buses such as RS-485 (https://en.wikipedia.org/wiki/RS-485).

Technically, RS-485 is a physical standard involving differential pairs, etc, but it's perfectly fine to use it between the built-in UARTs of multiple Raspberry Pis, at their native logic voltage levels. If you do that, you'll want to make sure that all of the hosts share a common ground reference. You might want to be sure that there is an appropriately sized pull-up (If memory serves me correctly) resistor on the bus. Keep the lines short and avoid EMI, such as running in parallel with high currents, e.g. power cables.

CAN bus is another option, but requires some additional hardware.

The key here is that these are asynchronous buses. There is no shared clock, driven by a master. What they share is an agreement that they will all communicate at a specific baud rate.

Fun fact: even though it's got fancy signaling and high throughput and all kinds of networking layers, Ethernet is built on the same principle: independent transmitters signalling on a shared medium at an agreed signalling frequency.

I hope that helps.

Michael

Statistics: Posted by michaelstoops — Tue Jul 01, 2025 7:32 am



Viewing all articles
Browse latest Browse all 8041

Trending Articles