Electronic Design

This page gives an overview of the electronic components that make up Tangara's hardware.

Block diagram of the system

The ESP32 is the main microcontroller that runs the system. It speaks to most of the supporting ICs over an I2C bus, but has other dedicated peripherals (SPI, I2S, UART) for higher speed communication where neccesary.

The ATSAMD21 is a secondary microcontroller (we often refer to it as a 'coprocessor') that serves as a kind of supervisor or interface to the ESP32; it supports firmware updates by acting as a USB->UART bridge, and controls charging and powering the rest of the system up and down.

I2C Bus

The I2C bus is used for low-speed communication between the ESP32 and a number of supporting ICs. By convention, the ESP32 is the controller, however theortically it should be possible to use the bus in multi-controller mode, with the ESP32 and ATSAMD21 sharing the controller role.

The non-controller devices attached to the bus are as follows:

AddressInterruptDeviceRole
0x20GPIO34PCA8575GPIO expansion
0x45GPIO35ATSAMD21Power management
0x1CGPIO25AT42QT2120Touchwheel
0x1AWM85233.5mm Audio
0x5ADRV2605LDGSHaptic feedback

See the 'Audio' section for further details on the WM8523.

PCA8575

The PCA8575 is a GPIO expansion IC that supports interrupts when its inputs change.

Its pins are configured as follows:

PinModeFunction
A0OutputSD mux switch
A1OutputSD mux enable
A2InputTop button
A3InputBottom button
A4InputLock switch
A5Unused
A6Unused
A7OutputSD card power
B0InputHeadphone detect
B1OutputAnalog power enable
B2InputSD card detect
B3Unused
B4OutputAmplifier unmute
B5Unused
B6Unused
B7Unused

Note: prerelease Tangaras (revisions earlier than R8) use B3 as an amplifier mute signal, and A5 as an active-low display reset signal.

ATSAMD21

The ATSAMD21 is a co-processor that handles system power management (turning off power, and monitoring the battery charge status), and USB connectivity. Its I2C interface contains read-only registers for getting the battery charge status, as well as command registers for shutting the system down, or enabling various different USB modes.

See the SAMD21 page for further documentation.

AT42QT2120

The AT42QT2120 is a capacative touch controller located on the faceplate. It drives the capacative touchwheel.

Keys 0, 1, and 3, are connected to be the electrodes in a capacative wheel.

Key 3 is used for the capacative button at the centre of the wheel.

Key 4 is a guard channel that surrounds the wheel.

DRV2605LDGS

The DRV2605LDGS is a haptic feedback motor driver with a large library of precreated effects. It is located on the faceplate, alongside the small ERM motor that it drives.

SPI Bus

The SPI bus is used for high-speed communication between the ESP32, and the display and SD card.

On the ESP32 side, we use the dedicated pins for the VSPI peripheral:

Pin nameSignal
GPIO23PICO
GPIO19POCI
GPIO18SCLK
GPIO22Display CS
GPIO21SD Card CS

Display

The display uses an ST7735 controller. This controller requires an additional data / register ('DR') pin for communication, and relies on PWM for controlling brightness. For better performance, these pins are connected directly to the ESP32.

Pin nameSignal
GPIO32Backlight
GPIO33DR

Audio

For 3.5mm audio output, the ESP32 communicates with the DAC, a WM8523, over a standard 4-pin I2S connection. The pinout on the ESP32 side is:

Pin nameSignal
GPIO0MCLK
GPIO26BCLK
GPIO27WS / LRCK
GPIO5DATA

The WM8523 is also connected to the I2C bus. This connection is used for power management, volume control, and configuring the exact I2S standard used.

The WM8523's audio output goes through a low-pass filter (-3dB @ 105kHz), and then to the amplifier; an INA1620. The amplifier as-implemented has a fixed gain of 2, and can be muted via a pin on the GPIO expander (see the 'I2C Bus' section).

SD Card

The SD card is accessible to both the ESP32 and the SAMD21, in SPI mode only.

In general, the ESP32 will have exclusive access to the SD card on the same SPI bus that used for the display. However, this access is gated behind an SPI multiplexer that allows the SD card to be disconnected from the ESP32's SPI bus, and instead connected to the SAMD21. At time of writing, the SAMD21's firmware does not support making use of this connection, however the intention is that this will allow a future firmware update to add support for fast data transfer to the device via USB Mass Storage.

Debugging interfaces

For most people, development over a USB-CDC/serial connection sh ould be sufficient. If you need more advanced debugging, or if you are attempting to recover from a bad flash, then you may need to make use of the dedicated programming ports. There two such footprints on Tangara's mainboard

ATSAMD21 SWD

On the rear side of the mainboard (the side that faces the faceplate; the ESP32 module and SD card slot are on this side), on the bottom left, is a row of 5 pads labelled 'SAMD SWD'. This is a 'Serial Wire Debug' port for the ATSAMD21.

We recommend a spring-loaded progo pin probe clip for connecting to these pads, e.g. Adafruit 5434.

This debug interface is compatible with the Black Magic Probe, which we higly recommend.

ESP32 JTAG

On the front side of the motherboard (containing the bulk of the small components), near the centre, there are two rows of rectangle pads labelled 'ESP32 JTAG'. This is a JTAG port, arranged in a standard ARM Cortex pinout.

For short-term debugging, it is easiest to simply solder individual wires to these pads, and then connect those wires to your debugger. If you wish to solder a header more permanently to these pads, the part number is Samtec FTSH-105-01-F-DV-K

The ESP32's LX6 cores are unfortunately not compatible with the Black Magic Probe at this time. See Espressif's documentation for instructions on how to use their version of OpenOCD.

If you require a USB <-> JTAG adapter, then we highly recommend SecuringHardware's Tigard.