Skip to content

Repository files navigation

Hello Nerves LCD SPI Example

Tiny Nerves demo that drives 320×480 SPI LCDs (ILI9486 / ST7796S) and optional touch (XPT2046 / GT911) on Raspberry Pi–class targets. The app shows build info, time, basic network status, and a demo image/text buffer.

Getting Started

# Pick your hardware target
export MIX_TARGET=rpi3      # or rpi4, etc.

# Pick your display variant (see table below)
export LCD_TYPE=c           # a | b | c | f | g   (defaults to a)

# Optional Wi-Fi
export NERVES_WIFI_SSID="your-ssid"
export NERVES_WIFI_PASSPHRASE="your-psk"

# Dependencies & firmware
mix deps.get
mix firmware

# Flash or upload
mix burn                    # SD card
./upload nerves.local       # OTA via ssh/mdns
  • The firmware advertises via mDNS as nerves.local (plus the serial-based hostname).
  • If you see “Image Nothing…”, place a 320×480 RGB565 file at priv/piyopiyoex_320x480.rgb565.

Display Types

Set LCD_TYPE to select panel + touch wiring/modules:

LCD_TYPE Panel LCD controller Touch controller Panel type
a Waveshare 3.5" RPi LCD (A) ILI9486 XPT2046 TFT
b Waveshare 3.5" RPi LCD (B) ILI9486 XPT2046 IPS
c Waveshare 3.5" RPi LCD (C) ILI9486 XPT2046 TFT
f Waveshare 3.5" RPi LCD (F) ST7796S GT911 IPS
g Waveshare 3.5" RPi LCD (G) ST7796S XPT2046 IPS
  • MHS 3.5" is compatible with c-type wiring.

Pins and Buses (Raspberry Pi)

From the code defaults:

LCD ili9486(for A/B/C)(SPI over spidev0.0):

  • SPI: spidev0.0
  • DC: GPIO 24
  • RST: GPIO 25
  • BL (backlight enable): GPIO 18

LCD ST7796S(for F/G)(SPI over spidev0.0):

  • SPI: spidev0.0
  • DC: GPIO 22
  • RST: GPIO 27
  • BL (backlight enable): GPIO 18

Touch XPT2046 (for A/B/C/G):

  • SPI: spidev0.1
  • IRQ (pen-irq): GPIO 17

Touch GT911 (for F):

  • I²C bus: i2c-1
  • I²C addr: 0x14 (7-bit)
  • INT: GPIO 4
  • RST: GPIO 17

Adjust as needed if your hat uses different pins.

Hardware Targets

Nerves builds depend on MIX_TARGET. If it is unset, the project runs on the host for fast cycles and utility tasks.

Typical targets: rpi3, rpi4, rpi5.

See the full list of supported Nerves targets.

Configuration

Key environment variables:

  • MIX_TARGET – Nerves system target (e.g., rpi3)
  • LCD_TYPE – one of a|b|c|f|g (default a)
  • NERVES_WIFI_SSID, NERVES_WIFI_PASSPHRASE – Wi-Fi credentials

Other notable config:

  • regulatory_domain set to "JP" in config/target.exs
  • SSH keys are required for shell/OTA (reads ~/.ssh/id_*.pub)

About

Nerves demo that drives 320×480 SPI LCDs (ILI9486 / ST7796S) and optional touch (XPT2046 / GT911) on Raspberry Pi targets

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Contributors

Languages