rdadush
Posts: 4
Joined: Thu Mar 23, 2023 1:00 pm

Raspberry Pi 4B interfaces

Thu Mar 23, 2023 1:03 pm

Hi,

I would like to know how many UART & I2C interfaces can I control at the same time?
I want to use 4 UARTs and 5 I2Cs simultaneously.


Best regards,
Roei Dadush

terribleted
Posts: 1074
Joined: Tue Oct 06, 2020 8:07 pm

Re: Raspberry Pi 4B interfaces

Thu Mar 23, 2023 2:07 pm

you do know I2C has addresses. up to ~100 devices can be connected to a single I2C as long as their addresses differ.
(7 bit addressing... but some are reserved)
https://learn.adafruit.com/adafruits-ra ... guring-i2c

as for UARTs, i found this:
https://pinout.xyz/pinout/uart#:~:text= ... 0your%20Pi.
i had a Trash-80 model 1 (circa 1980). upgrading from 4k to 16k of RAM, i thought "i'll never use this much RAM".
Now i have a computer with a million times that much memory. And i keep running out of it.
Not the computer....ME.

MiscBits
Posts: 1582
Joined: Wed Jan 27, 2021 12:48 pm

Re: Raspberry Pi 4B interfaces

Thu Mar 23, 2023 3:26 pm

What speed and controls do you want on the UART?

By default, the Pi uses TX/RX and GND - for other signal handling (RTS/CTS etc) you really need to go external chips often HAT or USB based.

The other thing to think about is voltage - the Pi only like 3.3v where as serial can be all over the place.

User avatar
thagrol
Posts: 9234
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Raspberry Pi 4B interfaces

Thu Mar 23, 2023 5:45 pm

MiscBits wrote:
Thu Mar 23, 2023 3:26 pm
for other signal handling (RTS/CTS etc) you really need to go external chips often HAT or USB based.
That's not entirely correct.

The device tree overlays for uart2 through uart5 support CTS and RTS if enabled in config.txt. They're 3.3v only same as the RX and TX pins. Details in /boot/overlays/README

To use uart2 you'll need to disable both the HAT EEPROM probe and the PoE HAT fan control.

AIUI it is not possible to use both of uart0 and uart1 as GPIOs 32, 33, 36, 37, 40, and 41 are not routed to the GPIO header one oof these UARTS can be routed to GPIO 14 and 15 by default the other goes to the bluetooth controller. Disabling bluetooth won't help.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Paul Hutch
Posts: 822
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA

Re: Raspberry Pi 4B interfaces

Thu Mar 23, 2023 7:44 pm

MiscBits wrote:
Thu Mar 23, 2023 3:26 pm
The other thing to think about is voltage - the Pi only like 3.3v where as serial can be all over the place.
The are only two other voltage level systems that most users will ever need to consider, TTL 5V(e.g. Arduino) and TIA-232 (+/-3 to +/- 15). For both there are many component, chip, and PCB level solutions available off the shelf that will interface the RasPI's +3.3V pins to these other levels.

Here's two examples of PCB level solutions:
3.3V to 5V https://www.sparkfun.com/products/12009
TIA-232 https://www.mikroe.com/max3232-board

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 7148
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.

Re: Raspberry Pi 4B interfaces

Thu Mar 23, 2023 8:01 pm

Paul Hutch wrote:
Thu Mar 23, 2023 7:44 pm
MiscBits wrote:
Thu Mar 23, 2023 3:26 pm
The other thing to think about is voltage - the Pi only like 3.3v where as serial can be all over the place.
The are only two other voltage level systems that most users will ever need to consider, TTL 5V(e.g. Arduino) and TIA-232 (+/-3 to +/- 15). For both there are many component, chip, and PCB level solutions available off the shelf that will interface the RasPI's +3.3V pins to these other levels.

Here's two examples of PCB level solutions:
3.3V to 5V https://www.sparkfun.com/products/12009
TIA-232 https://www.mikroe.com/max3232-board
and, maybe, the similar, somewhat historical, RS232 variations: FWIW, some (old/ancient) notes here: https://www.cpmspectrepi.uk/rs232/rs232.htm
and a couple of pi interfaced examples here:
https://www.cpmspectrepi.uk/raspberry_p ... apter.html (connected device sadly no longer "with us")
https://www.cpmspectrepi.uk/raspberry_p ... 000zc.html (somewhat unusual "protocol" but still "viable")
Trev.
Begining to test Bullseye on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B, B+, and a A+) and Pi's with cameras with Buster on the P3B+, some P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

MiscBits
Posts: 1582
Joined: Wed Jan 27, 2021 12:48 pm

Re: Raspberry Pi 4B interfaces

Thu Mar 23, 2023 9:22 pm

thagrol wrote:
Thu Mar 23, 2023 5:45 pm
...
That's not entirely correct.

The device tree overlays for uart2 through uart5 support CTS and RTS if enabled in config.txt. They're 3.3v only same as the RX and TX pins. Details in /boot/overlays/README

...
The problem I hit was getting Python to use this on uart2 - its possible that I had the config.txt or PySerial wrong (rtscts control in the class) or it is not fully supported at the far end but as soon as I moved to external hardware then my issues cleared up.
Paul Hutch wrote:
MiscBits wrote:
Thu Mar 23, 2023 3:26 pm
The other thing to think about is voltage - the Pi only like 3.3v where as serial can be all over the place.
The are only two other voltage level systems that most users will ever need to consider, TTL 5V(e.g. Arduino) and TIA-232 (+/-3 to +/- 15)...
Actually you need to cope with ±25V (open circuit) - I've seen +20 on printers before today and ±10 on serial extenders :roll:

I've also seen a telephone line blow up a serial port but the guilty party never wants to talk about it (still not worked out why the modem was removed) :lol:

Paul Hutch
Posts: 822
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA

Re: Raspberry Pi 4B interfaces

Thu Mar 23, 2023 9:32 pm

MiscBits wrote:
Thu Mar 23, 2023 9:22 pm
Actually you need to cope with ±25V (open circuit) - I've seen +20 on printers before today and ±10 on serial extenders :roll:
That's part of TIA-232, they must withstand +/-30V but the operational range is +/-3V to +/-15V.

Paul Hutch
Posts: 822
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA

Re: Raspberry Pi 4B interfaces

Thu Mar 23, 2023 9:36 pm

FTrevorGowen wrote:
Thu Mar 23, 2023 8:01 pm
and, maybe, the similar, somewhat historical, RS232 variations: FWIW, some (old/ancient) notes here: https://www.cpmspectrepi.uk/rs232/rs232.htm
and a couple of pi interfaced examples here:
https://www.cpmspectrepi.uk/raspberry_p ... apter.html (connected device sadly no longer "with us")
https://www.cpmspectrepi.uk/raspberry_p ... 000zc.html (somewhat unusual "protocol" but still "viable")
Trev.
RS-232 is a very old subset of TIA-232.

It was introduced in 1960 as recommended standard and named RS-232. Upon adoption in 1986 it became EIA-232, followed by TIA/EIA-232 in 1991, ANSI/TIA-232 in 2002 and finally just TIA-232 in 2012.

rdadush
Posts: 4
Joined: Thu Mar 23, 2023 1:00 pm

Re: Raspberry Pi 4B interfaces

Sun Mar 26, 2023 12:39 pm

terribleted wrote:
Thu Mar 23, 2023 2:07 pm
you do know I2C has addresses. up to ~100 devices can be connected to a single I2C as long as their addresses differ.
(7 bit addressing... but some are reserved)
https://learn.adafruit.com/adafruits-ra ... guring-i2c

as for UARTs, i found this:
https://pinout.xyz/pinout/uart#:~:text= ... 0your%20Pi.

Hi,

First, thanks for your reply.
I know how I2C works. I need in my design 5 different I2C channels & 4 UART channels.

User avatar
thagrol
Posts: 9234
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK

Re: Raspberry Pi 4B interfaces

Sun Mar 26, 2023 1:12 pm

rdadush wrote:
Sun Mar 26, 2023 12:39 pm
I know how I2C works. I need in my design 5 different I2C channels & 4 UART channels.
But you quite clearly don't know how to read documentation.

If you did you'd know that the BCM2711 used in the 4B has six UARTs and multiple I2C controllers as well as the ability to bitbang I2C and control I2C multiplexers.

Have a read through /boot/overlats/README for how to enable them.
Knowledge, skills, & experience have value. If you expect to profit from someone's you should expect to pay for them.

All advice given is based on my experience. it worked for me, it may not work for you.
Need help? https://github.com/thagrol/Guides

Return to “Interfacing (DSI, CSI, I2C, etc.)”