Your Coral dev board comes blank, and will need to be fastboot'd in order to load the firmware on.
The Coral Getting Started guide will show you the process. It's not pleasant unless you happen to have all the right cables and software already, it should take you under an hour.
You'll need USB C cables and adapters!
USB 3-in-1 Sync and Charge Cable - Micro B / Type-C / Lightning
USB A to USB C Adapter
When connecting HATs or Bonnets, the tall heatsink of the Coral can interfere with attaching it - be sure to pick up some 2x20 GPIO Lifters or Stacking headers!
2x20 Socket Riser Header for Raspberry Pi HATs and Bonnets
Stacking Header for Pi A+/B+/Pi 2/Pi 3 - 2x20 Extra Tall Header
Once you've got the Coral fastboot'd you will be able to set up and test WiFi:
Verify you have a WiFi connection with sudo ping 8.8.8.8
The good news about the mendel distribution is it already has Python3 installed by default
Install libgpiod
libgpiod is what we use for gpio toggling, it doesn't come in installations yet but its easy to add by running our script. You'll probably need to run this as root, so sudo bash
before you...
cd ~
wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/libgpiod.sh
chmod +x libgpiod.sh
./libgpiod.sh
A few minutes and a lot of text later...
After installation you should be able to import gpiod
from within Python3
Update Your Board and Python
Run the standard updates:
sudo apt-get update
sudo apt-get upgrade
and
sudo pip3 install --upgrade setuptools
Check UART, I2C and SPI
A vast number of our CircuitPython drivers use UART, I2C and SPI for interfacing. Luckily, they're already enabled. Check by running ls /dev/i2c* /dev/spi*
Install the support software with
sudo apt-get install -y python3-smbus python3-dev i2c-tools
sudo adduser mendel i2c
You can get info about the I2C interfaces with sudo i2cdetect -l
You can test to see what I2C addresses are connected by running sudo i2cdetect -y 0
(internal I2C) or sudo i2cdetect -y 1
(pins #3 and #5) and sudo i2cdetect -y 1
(pins #27 and #28)
You'll note there looks like an RTC on address 0x68 (a common RTC address). Some addresses are pre-allocated by the kernel (unavailable UU)
For the GPIO interface chips, you can check with sudo gpiodetect and sudo gpioinfoto see the 5 32-pin busses
Install Python libraries
Now you're ready to install all the python support
Run the following command to install adafruit_blinka
pip3 install adafruit-blinka
The computer will install a few different libraries such as adafruit-pureio
(our ioctl-only i2c library), spidev
(for SPI interfacing), Adafruit-GPIO
(for detecting your board) and of course adafruit-blinka
That's pretty much it! You're now ready to test.
Create a new file called blinkatest.py with nano or your favorite text editor and put the following in:
import board import digitalio import busio print("Hello blinka!") # Try to great a Digital input pin = digitalio.DigitalInOut(board.GPIO_P13) print("Digital IO ok!") # Try to create an I2C device i2c = busio.I2C(board.SCL, board.SDA) print("I2C ok!") # Try to create an SPI device spi = busio.SPI(board.SCLK, board.MOSI, board.MISO) print("SPI ok!") print("done!")
Save it and run at the command line with
sudo python3 blinkatest.py
You should see the following, indicating digital i/o, I2C and SPI all worked