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

  • install libgpiod-dev (sudo apt install libgpiod-dev)
  • make sure that the -DUSE_RPI cmake option is set to ON

Pinout

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

image

Compile Options

You need to 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

  • activate SPI with raspi-config

By default the "/dev/spidev0.0" device is used. Here is the PulseView output of the SPI Sketch

image

I2C

  • The sketch needs to be run with sudo
  • activate I2C with raspi-config

By default the "/dev/i2c-1" device is used. Here is the PulseView output of the I2C Sketch:

image

UART

  • Disable Serial Console in raspi-config (Interface Options > Serial Port)
  • Check in /boot/firmware/config.txt that enable_uart=1 is active
  • The device /dev/serial0 is used for Serial2 when using -USE_RPI

Here is the Puseview output of the Serial2 sketch:

image
Clone this wiki locally