Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Raspberry Pi 4B
===============

.. tags:: chip:bcm2711, experimental
.. tags:: arch:arm64, chip:bcm2711, vendor:raspberry-pi, experimental

.. warning::

Expand All @@ -13,17 +13,6 @@ Raspberry Pi 4B
found an issue with any of the implementation! See :doc:`the contributing
guidelines </contributing/index>`.

.. warning::

The SPI driver implemented for the :doc:`BCM2711 <../../index>` has only been
tested on SPI0. It appears that even using the special `overlays
<https://github.com/raspberrypi/linux/blob/stable/arch/arm/boot/dts/overlays/README>`_
for the device tree passed to the proprietary firmware does not properly
initialize the remaining SPI interfaces, and thus they have not been working
properly. More effort is required to reverse engineer the magic incantations
required to initialize these interfaces, at which point it is assumed that
the driver implementation should extend to SPI3-6.

The `Raspberry Pi 4B <https://www.raspberrypi.com/products/raspberry-pi-4-model-b/specifications/>`_ is an ARM64
hobbyist board created by Raspberry Pi.

Expand All @@ -33,7 +22,7 @@ hobbyist board created by Raspberry Pi.
:alt: Raspberry Pi 4B board

Features
=========
========

- Broadcom BCM2711 @1.8GHz
- 1, 2, 4 and 8GB LPDDR4-3200 SDRAM models
Expand All @@ -48,8 +37,50 @@ Features
- 4-pole stereo audio and composite video port
- Micro SD card slot

ARM64 Toolchain
===============
Board Peripheral Support
========================

SMP is currently unsupported. To see support for chip peripherals (I2C, SPI,
UART, etc), see the :doc:`BCM2711 page <../../index>`

NuttX for the Raspberry Pi 4 supports these on-board peripherals:

======================== =======
Peripheral Support
======================== =======
AV port No
HDMI No
WiFi No
Ethernet No
USB 3.0 No
USB 2.0 No
Bluetooth No
microSD card Yes (see notes in BCM2711 page)
======================== =======

Buttons and LEDs
================

The board has two LEDs:

* SD card activity (green)
* Power (red)

These LEDs are controlled by proprietary firmware at the beginning of the boot
process. Afterwards, NuttX controls them with the ``autoleds`` framework. At
this time:

* Red LED is solid for assertion failure, or blinks on panic
* Green LED is solid when NuttX has started

Power Supply
============

The board can be supplied power either through the USB-C connection (5V) or via
the 5V power input pin.

Installation
============

Before building NuttX for the Raspberry Pi 4B, download the ARM64 Toolchain for
**AArch64 Bare-Metal Target** ``aarch64-none-elf`` from
Expand All @@ -70,21 +101,7 @@ Check the ARM64 Toolchain:

$ aarch64-none-elf-gcc -v

Building
========

To build NuttX for the Raspberry Pi 4B, :doc:`install the prerequisites </quickstart/install>` and :doc:`clone the git
repositories </quickstart/install>` for ``nuttx`` and ``apps``.

Configure the NuttX project to use the Raspberry Pi 4B and build it (this example uses the ``nsh`` configuration).

.. code:: console

$ cd nutxx
$ tools/configure.sh raspberrypi-4b:nsh
$ make

Booting
Flashing
========

In order to boot NuttX on the Raspberry Pi 4B, you will need to have a formatted micro SD card. The SD card should
Expand Down Expand Up @@ -152,26 +169,38 @@ appear onscreen:
NuttShell (NSH) NuttX-12.6.0-RC0
nsh> uname -a
NuttX 12.6.0-RC0 c4f3a42131-dirty Aug 6 2024 21:17:01 arm64 raspberrypi-4b
nsh>
nsh>

Board Peripheral Support
========================
Configurations
==============

SMP is currently unsupported.
You can configure NuttX for the Raspberry Pi 4B using the following command:

To see support for general chip peripherals (I2C, SPI, UART, etc), see the
:doc:`BCM2711 page <../../index>`
.. code:: console

NuttX for the Raspberry Pi 4 supports these on-board peripherals:
$ ./tools/configure.sh raspberrypi-4b:<config>

======================== =======
Peripheral Support
======================== =======
AV port No
HDMI No
WiFi No
Ethernet No
USB 3.0 No
USB 2.0 No
Bluetooth No
======================== =======
Where ``<config>`` is one of the configurations listed below.

nsh
---

A simple configuration with NSH on the Mini-UART console, accessible using a TTL
cable connected to GPIO 14 & 15.

sd
--

Configuration which supports the microSD card peripheral on EMMC2. At boot time,
the microSD card is identified and the boot partition is mounted as a FAT file
system to ``/sd``. It can be written to and read from.

.. warning::

There is some instability with the microSD card functionality. Please see
:doc:`/platforms/arm64/bcm2711/index` for more information.

.. note::

This configuration enables BSD components since the :doc:`sdstress
</applications/testing/sd_stress/index>` application is BSD licensed.
40 changes: 38 additions & 2 deletions Documentation/platforms/arm64/bcm2711/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
BCM2711
=======

.. tags:: chip:bcm2711, experimental
.. tags:: arch:arm64, chip:bcm2711, vendor:broadcom, experimental

.. warning::

Expand All @@ -26,14 +26,50 @@ Supported Peripherals
======================== =======
Peripheral Support
======================== =======
I2C Full interrupt-based support, all interfaces work and tested.
I2C Full interrupt-based support. No 10b addressing.
UART Mini UART yes, PL011 no
GPIO Partial
MAILBOX Partial (polled method, only commands used by firmware are implemented)
EMMC2 Interrupt-based support, no DMA.
EMMC Supported alongside EMMC2 in theory, but untested.
PWM No
SPI Interrupt-based driver (no DMA) for all SPI except 1 & 2 (auxiliary)
PCM No
======================== =======

.. warning::

The SPI driver implemented for the :doc:`BCM2711 <../../index>` has only been
tested on SPI0. It appears that even using the special `overlays
<https://github.com/raspberrypi/linux/blob/stable/arch/arm/boot/dts/overlays/README>`_
for the device tree passed to the proprietary firmware does not properly
initialize the remaining SPI interfaces, and thus they have not been working
properly. More effort is required to reverse engineer the magic incantations
required to initialize these interfaces, at which point it is assumed that
the driver implementation should extend to SPI3-6.

.. warning::

The EMMC2 peripheral connects to the microSD card slot on the :doc:`Raspberry
Pi 4B </platforms/arm64/bcm2711/boards/raspberrypi-4b/index>`. Currently, it
has been tested using a 32GB Samsung microSD card and it has passed testing
with that. The only quirks are:

* No card insertion/removal interrupts work, so hotswapping isn't possible
* The :doc:`sdstress </applications/testing/sd_stress/index>` example works
unless the 'number of bytes' option is greater than 1023. I suspect this is
something to do with the FIFO depth being only 1023 bytes.

However, the 64GB microSD card exhibits very strange behaviour. There are
often data CRC errors that prevent the boot filesystem from mounting. When
that somehow passes (intermittent), running ``ls`` on the filesystem repeatedly
sometimes causes certain files to disappear from the listing (they are not
deleted and appear again on next boot), or causes their filenames to be shown
in all caps. Writing to the card with ``echo`` often fails with data CRC
error or timeout, and then the card is buggy for the remainder of the
session. **It is not recommended to use 64GB cards with this implementation
for the time being.**

Supported Boards
================

Expand Down
1 change: 1 addition & 0 deletions arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ config ARCH_CHIP_BCM2711
select ARCH_HAVE_MULTICPU
select ARCH_USE_MMU # Required for up_testset
select ARMV8A_HAVE_GICv2
select ARCH_HAVE_SDIO
---help---
Broadcom BCM2711 quad-core ARM Cortex A72

Expand Down
8 changes: 7 additions & 1 deletion arch/arm64/src/bcm2711/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ if(CONFIG_BCM2711_I2C)
endif()

# SPI interfaces
#

if(CONFIG_BCM2711_SPI)
list(APPEND SRCS bcm2711_spi.c)
endif()

# EMMC interfaces

if(CONFIG_BCM2711_EMMC)
list(APPEND SRCS bcm2711_sdio.c)
endif()

target_sources(arch PRIVATE ${SRCS})
48 changes: 48 additions & 0 deletions arch/arm64/src/bcm2711/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,54 @@ config BCM2711_SPI6

endif # BCM2711_SPI

#####################################################################
# SDMMC Configuration
#####################################################################

config BCM2711_EMMC
bool "EMMC support"
select MMCSD
select MMCSD_SDIO
select SDIO_BLOCKSETUP
depends on EXPERIMENTAL
default n
---help---
Enables support for EMMC interfaces.

if BCM2711_EMMC

config BCM2711_EMMC1
bool "EMMC1 interface support"
depends on BCM2711_EMMC
default n
---help---
Enables support for the EMMC1 interface.

config BCM2711_EMMC1_XFERSPEED
int "EMMC1 transfer speed (Hz)"
depends on BCM2711_EMMC1
range 25000000 208000000
default 25000000
---help---
The transfer speed in Hz to use for EMMC1 transfers.

config BCM2711_EMMC2
bool "EMMC2 interface support"
depends on BCM2711_EMMC
default n
---help---
Enables support for the EMMC2 interface.

config BCM2711_EMMC2_XFERSPEED
int "EMMC2 transfer speed (Hz)"
depends on BCM2711_EMMC2
range 25000000 208000000
default 25000000
---help---
The transfer speed in Hz to use for EMMC2 transfers.

endif # BCM2711_EMMC

endmenu # Broadcom BCM2711 Peripheral Selection

endif # ARCH_CHIP_BCM2711
8 changes: 7 additions & 1 deletion arch/arm64/src/bcm2711/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ CHIP_CSRCS += bcm2711_i2c.c
endif

# SPI interfaces
#

ifeq ($(CONFIG_BCM2711_SPI),y)
CHIP_CSRCS += bcm2711_spi.c
endif

# EMMC interfaces

ifeq ($(CONFIG_BCM2711_EMMC),y)
CHIP_CSRCS += bcm2711_sdio.c
endif
Loading
Loading