Skip to content

Raspberry PI

Phil Schatzmann edited this page Oct 5, 2025 · 23 revisions

Preconditions

You can run this emulator on an Rasperry PI

  • make sure that the -DUSE_RPI cmake option is set to ON
  • install libgpiod-dev (sudo apt install libgpiod-dev)
  • activate SPI and I2C with raspi-config

Pinout

The Raspberry PI is using Linux and provides the following pins:

image

Compile Options

You can set the -DUSE_RPI=ON option to activate the Linux API E.g:

cmake -DUSE_RPI=ON ..

Blink Sketch

In linux we can use the HardwareGPIO_RPI class: by default the device gpiochip0 is used. If you want to use another device, you can indicate it in the constructor of HardwareGPIO_RPI;

Here is the PulseView output of the Blink Sketch

image

SPI Sketch

In Linux we can use the HardwareSPI_RPI class: by default the device "/dev/spidev0.0" is used. If you want to use another device, you can indicate it in the constructor of HardwareSPI_RPI;

Here is the PulseView output of the SPI Sketch

image

UART

  • Disable Serial Console in raspi-config (Interface Options > Serial Port)
  • Check in /boot/config.txt that enable_uart=1 is active
  • The device /dev/serial0 is used for Serial3
Clone this wiki locally