Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The hardware

The Nix Vegas badge on a lanyard, its LED snowflake lit

The reference designators (J6, S3 and so on) come from the KiCad project, and everything here matches the v2.0 board that was fabricated (commit 07f6efc; later commits only touch the silkscreen and the README).

What the labels mean

SilkscreenPartWhat it is
LUSTRATESW2The power switch for the batteries. Plugging in USB powers the badge without it.
builtins.currentSystemSW1The core switch: ARM, RISC-V, or AUTO (see Switching CPU cores)
BOOTS1Picks the desktop profile at power-up; it’s also the mask ROM’s recovery strap
BUTTONS3The general purpose button, which picks the video profile at power-up and drives the LEDs and screens afterwards. The software calls it USER.
RESETS2Resets the module
DEBUGJ1USB-C to the on-board CH347, which gives you the serial console (115200 8N1) and JTAG, and powers the badge
USBJ9The module’s own USB-C port, a USB network adapter by default or a USB host in the desktop profile
ETHJ310/100 Ethernet, from the SoC’s built-in PHY
SDJ4The microSD slot
HDMIHDMI1HDMI out, through the LT8912B MIPI-DSI bridge
SAOSAO1The SAO connector (see below)
OLEDJ7A 4-pin I2C header for an SSD1306 or SH1106 OLED
PWRD5 (red)Power-good from the 3.3 V regulator
ACTD8 (green)Activity on the CH347
STATD3 (white)A status LED driven by the SoC

There are also a few headers without a label on the silkscreen: J6, the big 2x10 header; J5, the front header for the Sharp Memory Display; J8, a second OLED header wired the same way as J7; and J2, a small 2 mm header on the JTAG and console lines.

The silkscreen has a few power notes too. HDMI only gets its 5 V when the badge is on USB power, so it won’t work on batteries alone. USB host mode on the USB port needs power coming in through the DEBUG port. The HDMI link has the details of the HDMI output.

The 2x10 header (J6)

J6 is a 2.54 mm 2x10 header on the back of the badge, and it’s the main place to hang your own hardware off the badge. Odd pins are on one row and even pins on the other:

PinSignalPinSignal
1VSEL2+3.3 V
3LCD_RST (also BUTTON)4SPI3_CS
5LCD_PWR_CT6SPI3_SDI
7LCD_PWM8SPI3_SDO
9PWM0_BUCK10SPI3_SCK
11SAO_GPIO212I2C1 SCL
13+1.8 V14I2C1 SDA
15+1.8 V16GND
17ADC318GND
19GND20GND

A few things to know about these pins:

  • VSEL is whatever is powering the badge at the moment, so it’s about 5 V on USB power and the battery pack’s voltage on batteries. The +1.8 V pins come from the same regulator as the HDMI bridge, so don’t load them much while HDMI is running.
  • SPI3 is the same bus that drives the LED ring. The ring gets SPI3_SDO through an AND gate (U10) with SPI3_CS, so it only listens while CS is high, and every time CS goes low for another device the ring sees it as the end of a frame. A device on SPI3 has to share the bus with nix-badge-bling, which owns /dev/spidev3.0.
  • I2C1 is the bus the OLED headers use (/dev/i2c-1), on the module’s side of the SAO’s bus switch, so anything you put here shows up next to the OLED.
  • LCD_RST is the module’s LCD_RST pin, which is PWR_GPIO2 in the SoC’s always-on RTC domain. BUTTON is wired to it through a 100 Ω resistor, with a 10 kΩ pull-up to 1.8 V, so it reads low while BUTTON is pressed. It’s a 1.8 V-only pad, so never drive it above 1.8 V.
  • LCD_PWR_CT and LCD_PWM are the module’s pins 37 and 38, and are otherwise unused on the badge.
  • PWM0_BUCK and SAO_GPIO2 are GPIO lines 0 and 19 on the SoC’s second GPIO controller, named pwm0-buck and sao-gpio2 in the device tree.
  • ADC3 goes straight to a SARADC input with no divider, and Linux reads it as IIO channel 2 (in_voltage2_raw times in_voltage_scale gives millivolts). The other two channels measure VSEL and the battery through dividers.

The SAO connector

The SAO connector follows the newest SAO spec, v1.69bis (also called SAOv2, see badge.life). It’s mounted upside down, the same way as on this year’s official DEF CON badge, so an add-on hangs the other way up from what you’d expect. Check where pin 1 is before you plug one in.

PinSignal
13.3 V, switched and current-limited (U13)
2GND
3I2C1 SDA
4I2C1 SCL
5GPIO1: the LED ring’s data out
6GPIO2: sao-gpio2

The connector’s power and signals go through a load switch (U13) and a bus switch (U12), which BadgeOS turns on at boot. GPIO1 is the end of the LED ring’s WS2812 chain, buffered, so an add-on with its own WS2812s can sit at the end of the chain. Raise the LED count in badge.bling to drive them.

The other headers

J5, the front header for a Sharp Memory Display, is a 1x6 2.54 mm header on SPI3. The display shows up as the text console on tty1.

PinSignal
1VSEL
2Not connected
3GND
4SPI3_SCK
5SPI3_SDO
6CS, which is SPI3_CS inverted (Q7) because the display’s chip select is active high

J7 (labelled OLED) and J8 are 1x4 2.54 mm headers for an I2C OLED, in the usual pin order for the cheap SSD1306 modules:

PinSignal
1GND
2VSEL
3I2C1 SCL
4I2C1 SDA

J2 is a 1x8 2 mm header on the 3.3 V lines between the CH347 and the module. The JTAG lines have 33 Ω resistors between the CH347 and the module, and J2 sits on the CH347’s side of them.

PinSignal
1GND
2TCK
3TDO
4TDI
5TMS
6TRST
7UART0 TX (the console)
8UART0 RX

Power and the LED ring

The badge runs on three AA cells in series (BT1 to BT3) or on USB, with USB taking priority when it’s plugged in. A TPS63020 buck-boost makes the 3.3 V rail from that, and an RT9080 makes 1.8 V for the HDMI bridge. The RTC and the core-select latch stay powered from a tap after the first two cells (or from 3.3 V when that’s up, which is what “VRTC 2xAA/3v3” on the silkscreen means), with a supercapacitor to keep the RTC alive while you swap batteries.

The 24 WS2812 LEDs in the ring (LED1 to LED24) run from VSEL rather than the 3.3 V rail, on purpose. When the batteries get low, the ring turns into red glitch art, which we thought was more interesting than having it just dim out.