hzeller / rpi-rgb-led-matrix

Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO
GNU General Public License v2.0
3.7k stars 1.17k forks source link

Accessing all 6 UARTs of the RPi 4 Compute Module? #1575

Closed andytheengineerguy closed 1 year ago

andytheengineerguy commented 1 year ago

Note: This is a cross post from the Raspberry Pi forum; I wanted to post it here as well as my purpose for answering this question is to build an active-6 CM4 base-board for this rpi-rgb-led-matrix library :) https://forums.raspberrypi.com/viewtopic.php?t=354412

Hi all,

I've been tasked with designing base-board for a RPi 4 compute module to take advantage of the six UARTs, but I cannot find the GPIO Map for the BCM2711 (or the general pin out for this CPU), nor any other documentation that would help me reverse engineer this to figure it out.

I didn't expect to hit this roadblock given the open sourced nature of Raspberry Pi's, but I have been madly researching for the last 3 hours, and still... no luck. Of course, the standard 40 pin breakouts are backwards compatible, so GPIOs up to 27 are easily findable. However, I am referring to the GPIOs that become accessible via the compute module only, up to GPIO 43 for the 6th UART channel. Does anyone know how to access these elusive GPIOs?

Research so far 1. Lets begin with the docs. Chapter 11 of the BCM2711ARM Peripherals Datasheet states that there are "... six UARTs. One mini UART (UART1) and five PL011 UARTs (UART0, UART2, UART3, UART4 & UART5)". Additionally, Chapter 5 begins by stating "There are 58 General-Purpose Input/Output (GPIO) lines split into three banks. Bank 0 contains GPIOs 0 to 27, bank 1 contains GPIOs 28 to 45, and bank 2 contains GPIOs 46 to 57. All GPIO pins have at least two alternative functions withinBCM2711". Essentially, I want to access the GPIOs in bank 1 (28-45) and bank 2 (46-57) which are typically not accessible via the standard 40 pin header 2. These two chapters describe the functions of the GPIOs, the GPIOs needed to access all 6 UARTS, how they are multiplexed, and also their alternative function names (AT0 ... ALT5). However, the critical piece of the puzzle - the hardware pins the GPIOs mapped to - is not present in the documentation. 3. Raspberry Pi have not released design files or schematics (?) for the compute module 4, making it impossible to check the pin outs via the schematic symbols or trace names 4. Raspberry Pi have released the design files for the CM4 IO board. From here, we are able to see the pin names of all the signals coming out of the two high density Hirose connectors via the schematic. So close..! But unfortunately, the GPIO names from 27 upwards are still not visible. Presumably, these additional GPIO pins are being used for the ethernet and SD card interfaces, but we can't tell; once again this information is obscured. 5. The community at elinux has put together the most comprehensive table with all information compiled from docs mentioned above, including information from raspi-gpio itself (https://elinux.org/RPi_BCM2711_GPIOs). Yet still, pin numbers are still not known.

If anyone has managed to access even a single GPIO outside of the standard 40 pin header, I would love to hear from you.

I hope this information provided gives a clear picture of this issue & the available material about it today. Thank you, I am hoping that together we can figure this out.

Andy

ledvinap commented 1 year ago

Not all GPIO pins are available, even on CM4. Some are used as RGMII, some connected to eMMC (as you observed in 4.). You can check ALT functions on CM4 and then cross-reference them against https://datasheets.raspberrypi.com/cm4/cm4-datasheet.pdf pinout ...

(edit) You can access 5 serial ports on documented GPIO.

andytheengineerguy commented 1 year ago

Thanks for the speedy reply @ledvinap, I'll give this a shot.

andytheengineerguy commented 1 year ago

After speaking with PhilE from the Raspberry Pi forum, I've confirmed that unfortunately no additional GPIOs are accessible via the two high density connectors from the CM4. This makes the CM4 unable to support any additional LED chains, unlike its older brother CM3+

Shame. But all these extra peripherals don't come for free I guess....

Closing this issue.