While not relevant for cross-compilation, this page describes how to setup i2c peripherals or the pi-camera. It is added to this guide for completeness to start you own projects.
Source: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c
XCS~$ ssh rpizero-local
RPI~$ sudo apt-get install python2.7 python3 python-smbus python3-smbus python-dev python3-dev i2c-tools
Edit boot.txt
so i2c is loaded upon startup
RPI~$ sudo nano /boot/config.txt
Add the following lines to the bottom of the file
#enable i2c
dtparam=i2c1=on
dtparam=i2c_arm=on
Edit modules
so the i2c kernel is loaded
RPI~$ sudo nano /etc/modules
Add the following lines to the bottom of the file
#load i2c
i2c-bcm2708
i2c-dev
Allow pi-user to use i2c
RPI~$ sudo adduser pi i2c
Shutdown RPi and disconnect from the power supply
RPI~$ sudo shutdown now
Connect your i2c device and powerup.
Check if an i2c device is found:
RPI~$ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
The number shown is the i2c address of the device you connected.
Source: https://thepihut.com/collections/raspberry-pi-hats/products/rtc-pizero
i2cdetect
lists it as a i2c device.Edit boot.txt
so the RTC is loaded upon startup
XCS~$ ssh rpizero-local
RPI~$ sudo nano /boot/config.txt
Add the following lines to the bottom of the file
#enable rtc
dtoverlay=i2c-rtc,ds1307
Edit modules
so the RTC kernel is loaded
RPI~$ sudo nano /etc/modules
Add the following lines to the bottom of the file
#load rtc
rtc-ds1307
Allow (re)setting of the hw-clock
RPI~$ sudo nano /lib/udev/hwclock-set
Comment out these lines:
# if [ -e /run/systemd/system ] ; then
# exit 0
# fi
Reboot to load RTC
RPI~$ sudo reboot now
Reading and setting the hwclock
can be done by:
RPI~$ sudo hwclock -r
RPI~$ sudo date -s "Fri Jan 20 10:53:40 CET 2017"
RPI~$ sudo hwclock -w
Source: https://www.kiwi-electronics.nl/io-pi-zero
..
After powerup, login via SSH and enable camera
XCS~$ ssh rpizero-local
RPI~$ sudo raspi-config
Goto Interfacing options > Camera > Select
and reboot
To test the camera, login with SSH with X-server enabled:
XCS~$ ssh -X rpizero-local
Take note on the message on login. If you see “Warning: untrusted X11 forwarding setup failed: xauth key data not generated” you might need to use the “-Y” instead of “-X” option.
Install the links2
image viewer
RPI~$ sudo apt-get install links2
Test the camera
RPI~$ raspistill -v -o test.jpg
View the preview.
RPI~$ links2 -g test.jpg
Depending on the speed of the connection, this might take a while.
If you see a message similar to:
Could not initialize any graphics driver. Tried the following drivers: x: Can't open display "(null)" fb: Could not get VT mode.
you should review the “ssh”-login-message and might need to use the “-Y” instead of “-X” option of
ssh
as noted above.
Having installed the peripherals, it is time to setup the cross-compilation environment.