Install Linaro on your DragonBoard 410c
We decided to try getting Blinka running in Linaro Debian because that's the recommended Debian installation available for the DragonBoard410c. Other distros could be made to work but you'd probably need to figure out how to detect the platform. Using other operating systems and CircuitPython is your call, we cannot provide support for that.
Download and install the latest linaro, for example we're using https://www.96boards.org/documentation/consumer/dragonboard/dragonboard410c/downloads/debian.md.html
There's some documentation to get started at https://www.96boards.org/documentation/consumer/dragonboard/dragonboard410c/installation/
If you are booting from an SD card, there's one small step you'll need to take before you can do that. There's a DIP switch on the underside labeled SD BOOT that you'll need to move to the ON position.
We've found the easiest way to connect is through a console cable, wired to the UART Serial port through a logic level shifter, and then on your computer, use a serial monitor at 115200 baud.
Once powered correctly and with the right SD card you should get a command prompt as root. You may need to press enter if it appears to stop.
You may want to create a new username, we recommend pi - if our instructions end up adding gpio access for the pi user, you can copy and paste them. You can do this by typing:
adduser pi
and then add the new user to the sudo group:
usermod -aG sudo pi
Just to secure the board, we also recommend you change the linaro user's password, which by default is linaro:
passwd linaro
Be sure to keep the password in a safe place in case you need it.
Once installed, you may want to enable mdns so you can ssh pi@linaro-developer
instead of needing to know the IP address. First you will need to update, then install:
sudo apt update
sudo apt install avahi-daemon
then reboot
Connecting to the Network
Before you can use your DragonBoard 410c, you will need to connect to a network. The DragonBoard 410c does not come with any ethernet ports, but there's still a couple of different options available. The first option is to get a USB hub with an ethernet line.
Connecting to WiFi
The other option is to connect to an access point with the onboard WiFi.
To see a list of WiFi Access point SSIDs, type:
nmcli dev wifi list
To connect to a WIFI access point, first create the connection, replacing YOUR_SSID with your WiFi name:
nmcli con add con-name WiFi ifname wlan0 type wifi ssid YOUR_SSID
Then set up the password for your access point by enabling WPA PSK. Change this to the appropriate type if your connection is different.
nmcli con modify WiFi wifi-sec.key-mgmt wpa-psk
And add your password, replacing YOUR_PASSWORD with your WiFi password:
nmcli con modify WiFi wifi-sec.psk YOUR_PASSWORD
Finally enable the connection:
nmcli con up WiFi
You can check the connection status by typing:
nmcli connection show
Set your Python install to Python 3 Default
There's a few ways to do this, we recommend something like this:
sudo apt install -y python3 git python3-pip
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
sudo update-alternatives --config python
Of course, change the version numbers if a newer version of Python is distributed.
Update Your Board and Python
Run the standard updates:
sudo apt update
sudo apt upgrade
Choose UTF-8 for character set if prompted
and
sudo pip3 install --upgrade setuptools
Update all your Python 3 packages with
pip3 freeze - local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
and
sudo bash
pip3 freeze - local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U
Install libgpiod
libgpiod is what we use for gpio toggling. Fortunately it's available for the DragonBoard 410c. You can install it with the following command:
sudo apt install libgpiod2 python3-libgpiod gpiod
After installation, you should be able to import gpiod
from within Python 3:
Enable UART, I2C and SPI
A vast number of our CircuitPython drivers use UART, I2C and SPI for interfacing, so you'll want to get those enabled.
You only have to do this once per board, unfortunately by default the SPI interface is disabled!
Install the support software with:
sudo apt install -y python-smbus python-dev i2c-tools
sudo adduser pi i2c
To use SPI, you will need to enable SPIDEV by running the following commands to modify the device tree node:
cd ~
git clone https://github.com/96boards/dt-update
cd dt-update
make
sudo scripts/db410c/enable-spidev.sh
Once you're done with both and have rebooted, verify you have the I2C and SPI devices with the command ls /dev/i2c* /dev/spi*
You should see at least one i2c device and one spi device
You can test to see what I2C addresses are connected by running sudo i2cdetect -r -y 0
(on pins 15/17) or sudo i2cdetect -r -y 1
(on pins 19/21)
In this case I do have a sensor on the 'standard' i2c port i2c-0 under address 0x77
The UART1 Serial Console on the DragonBoard 410c is connected to /dev/ttyMSM0. The UART1 GPIO Serial Port is connected to /dev/ttyMSM1.
Install Python Libraries
Now you're ready to install all the Python support.
Run the following command to install wheel and flask:
sudo pip3 install wheel flask
Next, run the following command to install adafruit_blinka:
sudo pip3 install adafruit-blinka
The computer will install a few different libraries such as adafruit-pureio
(our ioctl-only i2c library), 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_A) 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
Text editor powered by tinymce.