Raspberry Pi · RPI4-MODBP-4GB

Raspberry Pi 4 Model B

Raspberry Pi 4 Model B: a BCM2711 (four Cortex-A72 cores) running Linux.

LinuxRaspberry Pi
Raspberry Pi 4 Model BRaspberry Pi · BCM2711 · 4 × Cortex-A72 · 1.8 GHz · 4 GB · LinuxBCM2711Raspberry Pi 4 Model B123456789101112131415161eth EthernetGigabit Ethernet2can0 CANCAN (an MCP2515 HAT, SocketCAN)3spi0 SPISPI0 (40-pin header)4spi1 SPISPI1 (40-pin header)5i2c0 I²CI2C0 (40-pin header, pins 27-28: the HATEEPROM)6i2c1 I²CI2C1 (40-pin header, default)7uart0 UARTUART (40-pin header)8gpio GPIO40-pin header9pwm0 GPIOPWM 010pwm1 GPIOPWM 111usb USBUSB 3.0 / 2.012hdmi HDMIMicro-HDMI13radio RadioWi-Fi / Bluetooth14pwr Power5 V USB-C15v3v3 Power3.3 V (pins 1, 17)16v5 Power5 V (pins 2, 4)26 GPIO pins, each a port (pin3, …)

In short

Single-board computer: four 1.8 GHz Cortex-A72 cores (BCM2711), 1 to 8 GB of RAM (4 GB here: override `ram`), Gigabit Ethernet, Wi-Fi, two micro-HDMI. CAN through an MCP2515 HAT (SocketCAN, can0).

Clock1.8 GHz
Flash—
RAM4 GB
GPIO28
Logic3.3 V

Specs

From the board’s model in the store.

Processor
BCM2711 · 4× Cortex-A72
Clock
1.8 GHz
RAM
4 GB
GPIO pins
28
Logic level
3.3 V
Power
5 V USB-C (in); 3.3 V (pins 1, 17): 3.3 V; 5 V (pins 2, 4): 5 V
Current per pin
not in the board’s model yet
Buses
UART ×1, I²C ×2, SPI ×2
Runs
Linux

Pin map

Each pin by what it does. Hover or tap a pin to see what else it can be.

  • Power 3
  • Digital 11
  • Bus 17
  • pin3pin 3
  • pin5pin 5
  • pin7pin 7
  • pin8pin 8
  • pin10pin 10
  • pin11pin 11
  • pin12pin 12
  • pin13pin 13
  • pin15pin 15
  • pin16pin 16
  • pin18pin 18
  • pin19pin 19
  • pin21pin 21
  • pin22pin 22
  • pin23pin 23
  • pin24pin 24
  • pin26pin 26
  • pin29pin 29
  • pin31pin 31
  • pin32pin 32
  • pin33pin 33
  • pin35pin 35
  • pin36pin 36
  • pin37pin 37
  • pin38pin 38
  • pin40pin 40
  • pin27pin27
  • pin28pin28
  • pwr5 V USB-C
  • v3v33.3 V (pins 1, 17)
  • v55 V (pins 2, 4)

Watch out

What archec checks for this board, from its data. Each one names the check that catches it.

  • Its pins work at 3.3 V. A 5 V sensor’s output on one of them needs a level shifter between them.

    check pin-level

  • It gives 3.3 V (3.3 V (pins 1, 17)), 5 V (5 V (pins 2, 4)). Power each part from a rail at its own voltage.

    check board-supply

  • It has 1 UART, 2 I²C, 2 SPI. One more bus of a kind than that is an error.

    check board-peripheral

First model

A blink for this board: the board, an LED and a part that turns it over every 500 ms. archec checks it, then writes the code on the right.

main.archeOpen in the playground
project Blink "Blink" {
  version "0.1.0"
  edition "1.0"
  uses arche-hw-store "^0.1"
}

include "arche-hw-store/boards/raspberry-pi-4/raspberry-pi-4.arche"
include "arche-hw-store/devices/led/led.arche"

/// Turns the LED over at each step.
component Blinker "Blinker" {
  out led: requires Led
  fn blink "Blink" {
    ```arche
    led.toggle()
    ```
    wcet 50us
  }
}

/// The board, an LED on pin 3, and the blinker.
system Hw "Blink" {
  part board:   RaspberryPi4
  part led:     GpioLed
  part blinker: Blinker
  board.pin3 -> led.pin
  blinker.led -> led.led
}

/// The firmware: the blinker every 500 ms.
deployment OnBoard "On the board" {
  system Hw
  platform Hw
  binary blink on board {
    language go
    thread main "Blink" { runs blinker; period 500ms; step blink }
  }
}
archec gen --target goblink/parts.go
// Code generated by archec gen --target go: the parts the binary runs. DO NOT EDIT: run it again.


package main

import "math"

var _ = math.Abs

// @arche Blinker main.arche:11 component
// Blinker: Blinker
type Blinker struct {
	archePart
	Inbox chan Envelope
	Out   func(port string, m any)
	// Call: port.op(…) in the model — the operation of the part the port's link reaches (main.go sets it)
	Call  func(port, op string, args ...any) any
}

// @arche Blinker.init main.arche:11 init
func NewBlinker() *Blinker {
	self := &Blinker{Inbox: make(chan Envelope, 16), Out: func(string, any) {}, Call: func(string, string, ...any) any { return nil }}
	// USER CODE BEGIN Blinker.init
	// USER CODE END Blinker.init
	return self
}

// Send: a message on one of the part's ports.
func (self *Blinker) Send(port string, m any) { self.Out(port, m) }

// @arche Blinker.blink main.arche:13 fn
// Blink: Blink
func (self *Blinker) Blink() {
	self.Call("led", "toggle")
}

// @arche Blinker.receive main.arche:11 receive
// Receive: a message that arrived on one of the part's ports.
func (self *Blinker) Receive(port string, m any) {
	_, _ = port, m
}

blink/parts.go, one of the 155 files archec writes.

Open in the playground

Parts on the board

What each numbered part is. Click a number to find it on the board.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

Find the part

The quiz names a part: click it on the board. A first try scores a point.

Compare every board