Apug
Apug
Apug
20190206T074743Z
CONTENTS 1
Contents
1 Overview 2
5 Technical support 8
1 Overview
• 6 user-configurable GPIOs, with built-in support for running I2C or SPI bus masters over them.
The unit ships with a Bosch BNO055 absolute orientation sensor, connected via an internal I2C bus.
The firmware is based on open-source code which is provided to give you the option to build totally custom firmware.
The Atomic Pi has 6 GPIO pins available to users, and additional lines connected to the BNO055 sensor. Here's a
overview of them.
2.1 Addressing
In order to use GPIO pins from Linux, it's important to understand how they are addressed in various situations.
Each GPIO has a global number in the integer GPIO namespace used with the legacy GPIO interface (e.g. through
sysfs). This is considered a legacy interface but there are currently no plans to remove it. However, in addition
to that, recent Linux kernels expose GPIO chips, which are basically named sets of GPIOs of the same hardware
origin with a single base number; GPIOs are numbered sequentially within a chip, but the global GPIO namespace
itself needn't be contiguous.
Schematic name GPIO chip id Chip pin number Global pin number Connected devices
ISH_GPIO_0 gpiochip3 21 335
ISH_GPIO_1 gpiochip3 18 332 LED Green (active low)
ISH_GPIO_2 gpiochip3 24 338 LED Yellow (active low)
ISH_GPIO_3 gpiochip3 15 329
ISH_GPIO_4 gpiochip3 22 336
ISH_GPIO_7 gpiochip3 16 330
These signals are available on the Atomic Pi's 26-pin connector. If you have the Enchilada breakout board, the
signals are available as on it as well. Connector pin numbers are as follows:
Schematic name GPIO chip id Chip pin number Global pin number Connected devices
I2C2_3P3_SDA gpiochip0 62 476 BNO055 I2C SDA
I2C2_3P3_SCL gpiochip0 66 480 BNO055 I2C SCL
AU_MIC_SEL gpiochip1 0 341 XMOS Audio mi-
crophone loopback
selector
XMOS_RESET gpiochip1 8 349 XMOS Audio reset (ac-
tive low)
Schematic name GPIO chip id Chip pin number Global pin number Connected devices
BN_INT gpiochip1 17 358 BNO055-generated in-
terrupt (active low)
BN_RESET gpiochip1 25 366 BNO055 reset (active
low)
The XMOS_RESET line is controlled by a system service, atomicpi-hold-xmos, to bring up the XMOS Audio
device.
The AU_MIC_SEL line must be configured to logical 0 to record audio from microphone, or to logical 1 for loopback
(recording audio being played back).
Using the interrupt and reset lines is not strictly required for BNO055 operation. Additional devices may be con-
nected to its I2C bus but that would require soldering.
Note that the system core contains other GPIO pins, some connected to internal circuits. Reading the datasheet is
strongly recommended before attempting to configure them!
The traditional sysfs way of manipulating GPIOs from the command line is documented at:
https://www.kernel.org/doc/Documentation/gpio/sysfs.txt
Additionally, several utilities allow GPIO control using the more modern interface (and chip id + pin index
addressing):
Constants storing "<chip id> <pin index>" are prefixed by ATOMICPICHIP_. Due to shell expansion rules,
${ATOMICPICHIP_ISH_GPIO_0} (without quotes) will expand to two arguments, the chip id and the pin index,
which is what most of the following utilities expect.
List all GPIO chips, print their labels and number of GPIO lines:
gpiodetect
Find a GPIO line by name (the output of this command can be used as input for gpioget/gpioset):
gpiofind <name>
Print information about all lines of the specified GPIO chip(s) (or all chips if none are specified):
gpioinfo <gpiochip1> ...
Options:
-l, --active-low: set the line active state to low
Options:
-l, --active-low: set the line active state to low
-m, --mode=[exit|wait|time|signal] (defaults to 'exit'):
tell the program what to do after setting values
-s, --sec=SEC: specify the number of seconds to wait (only valid for --mode= ←-
,→ time)
-u, --usec=USEC: specify the number of microseconds to wait (only valid for -- ←-
,→ mode=time)
-b, --background: after setting values: detach from the controlling terminal
Modes:
exit: set values and exit immediately
wait: set values and wait for user to press ENTER
time: set values and sleep for a specified amount of time
signal: set values and wait for SIGINT or SIGTERM
Options:
-l, --active-low: set the line active state to low
-n, --num-events=NUM: exit after processing NUM events
-s, --silent: don't print event info
-r, --rising-edge: only process rising edge events
-f, --falling-edge: only process falling edge events
-F, --format=FMT specify custom output format
Format specifiers:
%o: GPIO line offset
%e: event type (0 - falling edge, 1 rising edge)
%s: seconds part of the event timestamp
%n: nanoseconds part of the event timestamp
atomicpi.signals contains a mapping from the signal name (e.g. "ISH_GPIO_0") to {chip,chip_←-
idx,global_idx}. You will need global_idx most of the time as sysfs-gpio uses the legacy sysfs
interface.
import atomicpi
import gpio as GPIO
# Control by signal ID
GPIO_0=atomicpi.signals.ISH_GPIO_0.global_idx
GPIO.setup(GPIO_0, GPIO.OUT)
GPIO.output(GPIO_0, True)
# Control with signal ID lookup on Enchilada connector first
GREEN_LED=atomicpi.signals[atomicpi.connectors.enchilada.leds.green].global_idx
GPIO.setup(GREEN_LED, GPIO.OUT)
GPIO.output(GREEN_LED, False)
GPIO.cleanup(GPIO_0)
GPIO.cleanup(GREEN_LED)
atomicpi.signals contains a mapping from the signal name (e.g. "ISH_GPIO_0") to {chip,chip_←-
idx,global_idx}. You will need global_idx most of the time as gpio uses the legacy sysfs interface.
The Atomic Pi has a BNO055 absolute orientation sensor attached to a custom GPIO I2C bus (configured as I2C
bus 50 by default). It combines an accelerometer, a gyroscope and a magnetometer.
You may need to calibrate the sensor to obtain desired accuracy. Consult the Bosch Sensortec reference
for details.
BNO055 is configured on I2C bus 50 in /etc/i2c-gpio-custom.d/bno055-bus by default var imu = new BN←-
O055({device:"/dev/i2c-50"}); imu.beginNDOF(function() { console.info('imu running'); setInterval(function() {
async.series({ calibrationStatus: imu.getCalibrationStatus.bind(imu), quaternion: imu.getQuaternion.bind(imu),
euler: imu.getEuler.bind(imu), linearAcceleration: imu.getLinearAcceleration.bind(imu) }, function(err, results) {
console.info( 'imu: ', JSON.stringify(results) ); }); }, 1000); });
The Atomic Pi can act as a I2C or SPI bus master on a custom set of GPIOs. This is implemented using kernel
modules i2c-gpio-custom and spi-gpio-custom (sources in /usr/src/, editable and buildable using D←-
KMS).
The kernel modules are by default configured using systemd services i2c-gpio-custom.service and
spi-gpio-custom.service. Modules are loaded on service start and unloaded on service stop.
5 Technical support
To save time, please have a look at the product FAQ page solutions. You may FAX questions to (408) 541-8459 or
email: support@digital-loggers.com.
For phone support, call (408) 330-5599 with the following so we can better serve you:
• a description of the Ethernet devices connected to your unit, for example, a 10/100 PC and crossover cable,
if it's relevant;
• a description of the WiFi or Bluetooth devices connected to your unit, i.e. their manufacturers and model
numbers, if it's relevant.
Open-source components used in the Atomic Pi are mostly unmodified, as they are in the Ubuntu Bionic distribution
(see apt list --installed).
Most additional components developed specifically for the Atomic Pi are provided in source form in the
firmware already. For example, avrdude support for the ATMega328PB is provided in source form as part
of /etc/avrdude.conf (it is not original).
Sources for the binary I2C and SPI custom-GPIO bus master kernel modules are provided in /usr/src in (configured
to be used by DKMS). Updated source versions will be available from Git repositories located at:
https://github.com/digitalloggers/i2c-gpio-custom.git
https://github.com/digitalloggers/spi-gpio-custom.git
Updated versions of the BNO055 sensor library for Node.JS will be available at:
https://github.com/digitalloggers/node-BNO055.git
DLI cannot provide warranty or technical support for modified units; this includes units with custom firmware.