Section 6.5

Development kit versus dongle

Definition

A development kit is a circuit board that a chip maker sells for developing firmware, the program that runs on its chip. It typically carries the chip, a debug probe that lets a computer load and inspect firmware, and buttons, lights and connectors for the chip’s pins. A dongle is a small board that plugs into a USB socket and carries the chip with few extras. Both can hold the same chip but wire its pins to different parts, so firmware built for one board is wrong for the other.

The idea

Firmware does not know what a light is. It knows that writing a 0 to pin 13 connects that pin to ground. Whether a light, a button, a serial cable or nothing at all is soldered to the pin is decided by the board, not by the chip. Two boards with the same chip are like two houses with the same fuse box and different wiring: switch 6 feeds the kitchen in one house and the garage in the other.

The picture stops in one respect. An electrician can follow a wire; firmware cannot look at the board. The tools that build the firmware must be given the wiring as a board description, and firmware built with the description of one board carries that board’s wiring inside it.

How it works

A board adds the following to a chip, and firmware depends on every item.

Firmware is therefore built for a named board. In the Zephyr RTOS §6.33 (real-time operating system) the board description is a devicetree §6.39 file. It maps logical names, such as led0 or the console (the text output of the firmware), to pins and to devices inside the chip. Source code that uses the logical names can be built again for another board. A finished firmware image cannot be moved: its pin numbers, its start address and the route of its console are fixed.

Worked example

Nordic Semiconductor sells two boards with its nRF52840 §6.4 chip: the nRF52840 DK, where DK stands for development kit, and the nRF52840 Dongle. The documentation of the two boards gives this wiring, in which P0.13 means pin 13 of port 0; a port is a group of pins.

Now suppose that a firmware image built for the DK is written to the Dongle with an external debug probe. To light the first LED, the image writes 0 to P0.13. No LED is connected to that pin on the Dongle, so nothing lights. The image sends its console text on P0.06, say at 115,200 bits per second. One bit lasts 1,000,000/115,200≈8.681{,}000{,}000 / 115{,}200 \approx 8.68 microseconds, and every 0 bit lights the Dongle’s green LED for that time. No text reaches the computer, because nothing on the Dongle connects P0.06 to the USB plug.

Stated precisely

A firmware image is right for a board exactly when every assumption it makes about the world outside the chip is true on that board. The assumptions are: for each external part that the image uses, the pin and the level that switches the part on; for each clock source that the image selects, that the crystal is fitted; the power source; the route of the console; the start address in flash memory, together with whatever a bootloader on the board expects; and the way the image is loaded and debugged.

A shared chip guarantees only what is inside the chip package: the same instruction set, the same built-in devices and the same memory sizes. It guarantees nothing about what is connected to the pins. The exact check is a comparison, item by item, of the image’s assumptions with the circuit diagram or the board description.

Limits and common mistakes

A successful load proves that the bytes were written to flash memory. It does not prove that the image suits the board.

The same logical name does not mean the same pin. In Zephyr, led0 is P0.13 on the DK and P0.06 on the Dongle.

The equal clocks are a fact about these two boards, not about the chip. Another board with the nRF52840 may omit the 32.768 kilohertz crystal. The chip must then make its slow clock without a crystal, and the firmware must select such a source.

A wrong image can do more than leave an LED dark. It can drive a pin that the other board connects to something else. Pin P0.12 reads a button on the DK and drives the blue part of the three-color LED on the Dongle.

A dongle gives up observability. The nRF52840 Dongle has no debug probe on the board. Stopping and inspecting its firmware needs an external probe, attached to contact points for SWD §6.25 (Serial Wire Debug), the two-wire debug interface of Arm processors.

Power wiring is a board matter too. The Dongle feeds the chip from the USB socket through a regulator inside the chip, and a register in the chip then sets the voltage on the pins.

Questions answered

Can the same chip image assume identical LEDs, clocks, and USB wiring on both boards?

No: a firmware image, the program file loaded into the chip, is built for one board, and a shared chip guarantees nothing about what is connected to the chip’s pins.

The start address of the image differs too, because the Dongle keeps a bootloader, a small program that starts the firmware, in the chip’s program memory. Build the firmware for each board from that board’s description, and check each item against the board’s documentation.

Related entries: Devicetree (§6.39), Board overlay (§6.41), Firmware build profile (§6.44), nRF52840 (§6.4), UART (§6.23), SWD (§6.25), J-Link (§6.27), Bootloader (§6.30). Further reading: [17].