Initial Setup

Right now, Blinka only supports the DragonBoard 410c (because that's the only board we've got for testing).

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/

Blinka only supports Linaro on the DragonBoard because that's the recommended OS we could find and it's easy to detect which board you have

Preparing the Board

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.

Logging in

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.

The DragonBoard 410c pin layout is different than Raspberry Pi and uses 1.8 Volt Logic Levels. Running with anything high could destroy your board.

USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi

PRODUCT ID: 954
The cable is easiest way ever to connect to your microcontroller/Raspberry Pi/WiFi router serial console port. Inside the big USB plug is a USB<->Serial conversion chip and at...
$9.95
IN STOCK

4-channel I2C-safe Bi-directional Logic Level Converter

PRODUCT ID: 757
Because the Arduino (and Basic Stamp) are 5V devices, and most modern sensors, displays, flash cards and modes are 3.3V-only, many makers find that they need to perform level...
$3.95
IN STOCK

Half-size breadboard

PRODUCT ID: 64
This is a cute half size breadboard, good for small projects. It's 2.2" x 3.4" (5.5 cm x 8.5 cm) with a standard double-strip in the middle and two power rails on both...
$5.00
IN STOCK

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 [email protected] 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.

USB 2.0 and Ethernet Hub - 3 USB Ports and 1 Ethernet

PRODUCT ID: 2909
One can never have enough socks, or USB ports. Add some more USB and Ethernet capability to your Raspberry Pi or, really, any kind of computer with this USB 2.0 and...
$17.50
IN STOCK

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, it doesn't come in installations yet but it's 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

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:

Download: file
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

This guide was first published on Jun 28, 2019. It was last updated on Jun 28, 2019. This page (Initial Setup) was last updated on Oct 16, 2019.