Embedded Systems fundamentals

Microcontrollers

A microcontroller is a single integrated circuit package containing a microprocessor and a number of other devices. Usually the other devices will at least include memory (RAM and flash memory), an interrupt controller, a GPIO (general purpose I/O) controller, clock signal generation and a number of peripheral devices, for example:

  • one or more timers (for measuring real time and generating timed events)
  • UART controller (for simple serial I/O communication)
  • analog-to-digital converter
  • digital-to-analog converter
  • USB controller
  • Ethernet (wired network) controller
  • radio (for wireless communication)

Microcontroller Development Kits

Microcontroller Development Kits are provided to allow hardware and software developers to evaluate a microcontroller and develop software (firmware) for it, prior to final product manufacturing. A development kit will provide some or all of the following features:

  • A microcontroller.
  • A means of powering the microcontroller (along with the rest of the development kit), usually using mini- or micro-USB, a dedicated power supply connector (usually a barrel connector) or a battery holder.
  • A built-in debug adapter (commonly) or connector for a stand-alone debug adapter (less com- monly). Development kits with built-in debug adapters usually use the same USB interface to communicate with the debug adapter and power the device (see above).
  • A number of LEDs and push-buttons, usually connected to General Purpose I/O (GPIO) pins on the microcontroller. The LEDs provide a rudimentary means for software developers to indicate status. Similarly, the push-buttons provide a means of obtaining simple user input.
  • In addition, a development kit will often provide a hardware reset pushbutton to reset (reboot) the microcontroller. Nordic Semiconductor development kits also use the reset button to place the kit into a bootloader flash mode, allowing the bootloader firmware to be updated or replaced.
  • Breakout connectors for a subset of the I/O pins on the microcontroller. Additional hardware devices can be connected to the microcontroller pins to construct prototype devices. Some microcontroller development kits support standard interfaces, such as the Arduino shield inter- face. Alternatively, jumper wires can be used to connect breakout pins directly to a device or to a breadboard for constructing prototype circuits.
  • A number of jumpers that can be shorted or left open to configure the behaviour of the development, for example, enabling or disabling the on-board debug adaptor.

Targets

When you develop software you can usually compile and execute the software on the same platform. When developing software for embedded systems, we write and build the firmware image on one platform (your desktop or laptop) but execute it on another platform, called the target. It is common for embedded operating systems and frameworks to support multiple targets, even for the same project. This simplifies the process of building the same code to execute on multiple hardware platforms. A target will be characterised by features such as microcontroller, memory size, attached hardware peripherals or compiler toolchain configuration (e.g. debug or release).

You will be targetting one of the Nordic Semiconductor microcontroller development kits for the Nordic Semiconductor nRF5 series microcontrollers. This series of microcontrollers integrate a low power ARM Cortex-M series microprocessor (either M0 or M4) with memory and peripherals into a single microcontroller package. The characterising peripheral is a 2.4GHz radio designed for Bluetooth Low Energy wireless communication.

nRF52-DK

The following are essential resources provided by Nordic for their microcontrollers and associated DKs:

Programming and Debugging

Firmware is stored in non-volatile flash memory on the target device. You will need a way to get the binary firmware image from your development machine to the target. Similarly, to test and debug the firmware as it executes, you will need to be able to perform standard software debugging operations such as:

  • setting, removing and (en-/dis-)abling breakpoints at specific lines of code (addresses)
  • inspecting the contents of memory and registers (values of variables)
  • controlling program execution (running, stopping or stepping execution)

The most commonly used standard for both programming and debugging embedded targets is the JTAG electrical interface and protocol. A JTAG adapter provides a JTAG interface to the target device on one side, and another interface, usually USB, to the computer used for debugging.

JTAG

The SEGGER J-Link is a widely used JTAG adapter that takes the form of a standalone device with JTAG and (usually) USB connectors or, more conveniently, as a J-Link OB system-on-chip device mounted on the target device circuit board with a USB port for connection to the debug computer, as illustrated below:

JLINK