The board file is much easier than the chip file. It basically involves loading the chip file and just mapping the chip pins to the physical pins on the board. At this time there hasn't a consistent naming of the pins due to the documentation provided by different manufacturers referencing the pins by different names.

For instance, naming pins like D4, to imply it is a digital pin number 4, or GPIO22 are pretty common. Some boards also use the same name as the microcontroller pin name like PC0. However, if the board you are using has a Raspberry Pi style connector, we recommended that you go with the D naming scheme since using a name like D4 will make it so it is more consistent with existing CircuitPython examples without needing changes.

If you followed the instruction in the software setup, you should have the Adafruit_Blinka folder in your home directory. Inside of there you'll want to navigate to src/adafruit_blinka/board which is where all of the board files are located, some of them sorted by manufacturer.

If you create a new folder, be sure that __init__.py exists inside the folder or PyPI won't install it.

For the Pine64, I'm just going to create a file called pine64.py. The first step is to start with creating each of the D pins and assigning it to the pins defined in the chip file. Once that's done, the next step is to create any aliases that are needed such as pins for I2C. We'll go over those a bit more in depth later in this guide. Here are the contents of the board file for the Pine64:

# SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Pin definitions for the Pine64."""

from adafruit_blinka.microcontroller.allwinner.a64 import pin

D2 = pin.PH3
D3 = pin.PH2
D4 = pin.PL10
D5 = pin.PH5
D6 = pin.PH6
D7 = pin.PH7
D8 = pin.PC3
D9 = pin.PC1
D10 = pin.PC0
D11 = pin.PC2
D12 = pin.PC4
D13 = pin.PC5
D14 = pin.PB0
D15 = pin.PB1
D16 = pin.PC6
D17 = pin.PC7
D18 = pin.PC8
D19 = pin.PC9
D20 = pin.PC10
D21 = pin.PC11
D22 = pin.PC12
D23 = pin.PC13
D24 = pin.PC14
D25 = pin.PC15
D26 = pin.PC16
D27 = pin.PH9

SDA = D2
SCL = D3

SCL2 = pin.PL8
SDA2 = pin.PL9

SCLK = D11
MOSI = D10
MISO = D9
CS = D8
SCK = SCLK

UART_TX = D14
UART_RX = D15

UART3_TX = pin.PD0
UART3_RX = pin.PD1

UART4_TX = pin.PD2
UART4_RX = pin.PD3

This guide was first published on Apr 01, 2020. It was last updated on Mar 13, 2020.

This page (Adding the Board File) was last updated on Jun 09, 2023.

Text editor powered by tinymce.