Skip to content

Instantly share code, notes, and snippets.

@maruel
Created January 2, 2017 03:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maruel/495b0b3a267ef9ccf1690e34f6326897 to your computer and use it in GitHub Desktop.
Save maruel/495b0b3a267ef9ccf1690e34f6326897 to your computer and use it in GitHub Desktop.
systemd files to enable SPI on startup on a C.H.I.P.
# Contributed to public domain by Marc-Antoine Ruel. No rights reserved.
[Unit]
Description=Enable SPI on C.H.I.P.
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'mkdir -p /sys/kernel/config/device-tree/overlays/spi; cat /lib/firmware/nextthingco/chip/sample-spi.dtbo > /sys/kernel/config/device-tree/overlays/spi/dtbo'
# Contributed to public domain by Marc-Antoine Ruel. No rights reserved.
[Unit]
Description=Enable SPI on C.H.I.P. upon boot
[Timer]
OnBootSec=1s
AccuracySec=1s
[Install]
WantedBy=timers.target
- Create the two files enable_spi.service and enable_spi.timer in /etc/systemd/system/
- Run the following:
sudo systemctl daemon-reload
sudo systemctl enable enable_spi.timer
sudo systemctl start enable_spi
/dev/spidev32766.0 should now be visible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment