Atmel SAMD21J18A Microcontroller

Key Specifications:

  • ARM Cortex-M0+ CPU running at up to 48MHz
  • 256KB in-system self-programmable Flash
  • 32-bit Real Time Counter (RTC)
  • One full-speed (12Mbps) USB 2.0 interface
  • Up to six Serial Communication Interfaces (SERCOM)
  • One 12-bit, 350ksps Analog-to-Digital Converter (ADC) with up to 20 channels
  • 10-bit, 350ksps Digital-to-Analog Converter (DAC)
  • Up to 52 programmable I/O pins
  • Watchdog Timer (WDT)


EQUiSat’s software stack is based on FreeRTOS, which, as its name suggests, is a free, open source, real time operating system (RTOS) intended for use on microcontrollers.  An RTOS is especially useful in the context of our mission, as it adheres to a strict schedule, ensuring events are responded to in a timely and deterministic manner.

Using FreeRTOS allows the different aspects of our software to be written as independent tasks that are executed according to their assigned priority.  This scheme ensures that the most urgent tasks will be carried out immediately, even if a task of lower importance is already running.

Development Tools

Atmel Studio

The software for EQUiSat is developed in Atmel Studio, Atmel’s integrated development platform (IDP). built on top of Visual Studio  This IDP allows us to develop in C and assembly, has a built in debugger, and allows us to easily target the SAMD21 with our builds.  Atmel Studio’s integration with the Atmel microcontroller and included libraries and example projects make it the obvious choice for developing EQUiSat’s software.

Atmel ICE

This tool is used to program the SAMD21 once it is soldered to the PCB using the JTAG interface.  It also has an embedded debugger which is very useful for debugging code running on the processor using Atmel Studio

Atmel SAMD21 Xplained Pro

We use the Xplained Pro, a development board based on the SAMD21, to assist us with development.  It has an embedded debugger, status LEDs, and exposed pins as male headers to make connecting and testing hardware peripherals much simpler.


Software Operation

EQUiSat’s software is responsible for controlling much of the satellite’s operation while in orbit, from initiating the antenna deployment to flashing the LED beacon to collecting data from various onboard sensors.  The software stack can be broken up into three main pillars: data collection, data transmission, and error correction.

Data Collection

We collect data from a variety of sensors on the satellite that interface with the microcontroller using different protocols.  The magnetometer (HMC5883L) and IR sensor (MLX90614) communicate over the I2C protocol, while the temperature sensor (AD590) and photodiode (TEMD6200FX01) are read using the processor’s ADC.

Data Transmission

The microcontroller communicates with our XDL Micro radio using 3.3V UART.  The software is responsible for sending commands over serial to correctly set the radio settings (frequency, baud rate, etc.) as well as storing our collected data and sending it to the radio for transmission.

The software also listens for uplinked packets received by the radio in the event we need to send a command to kill communications or send EQUiSat into a reduced low-power mode in case of an emergency.

Error Correction

While in orbit, bit flips (i.e. a 1 changes to a 0 or vice versa) can occur as a result of cosmic radiation.  The SAMD21 has 3 regions of memory that could potentially be affected by bit flips: the data memory, program memory, and bootloader.

Data Memory

The data memory (SRAM) is volatile, meaning a bit flip here can be fixed with a reboot.

Program Memory

In the program memory, one of the biggest risks is a bit flipping in a return address, thus changing the value of the address.  This, and other similar errors in the program code can be guarded against using a watchdog timer.  This timer counts down from a specified value.  If it reaches 0 before being reset to the original value, it triggers a reset of the entire system.  Therefore, inserting a call to reset the watchdog timer in the main loop of the program (the FreeRTOS kernel in this case)  will ensure that a reset takes place in the event that the program becomes corrupted.  In this case, a simple reboot wouldn’t solve the problem, since the program memory would still be corrupted.  Therefore, we have modified the bootloader to load a copy of the program memory stored in external memory, then copy it to overwrite the program memory on the Atmel chip.  The external memory is an MRAM (MR25H10) that is not affected by the radiation in LEO.


There is not much that can be done in the event of corruption in the bootloader, since it would require a second processor to overwrite the corrupted bootloader in the SAMD21.  However, the the bootloader is extremely small in size compared to the program memory and data memory, meaning corruption is much less likely to occur here.  By creating solutions for corruption in the program memory and data memory, we have significantly reduced the size of the vulnerable region, making it very unlikely for a bit flip to damage the system.

We Are Open Source!

Brown Space Engineering’s primary mission is to make space more accessible to everyone.  We encourage others to replicate and hopefully even build on our work.  To help facilitate this, all of our code can be found on our GitHub repo. Feel free to fork of course and contact us if you have any questions.