Created
January 2, 2017 03:38
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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