Atmel’s SAM D20 lineup is based on the ARM Cortex- M0+ core, setting a new benchmark for flexibility and ease-of-use. The microcontroller (MCU) series is ideal for a number of low-power, cost-sensitive industrial and consumer devices, such as GPS trackers, appliance controllers, intelligent remotes and optical transceivers.
As William Wong of Electronic Design notes, the SAM D20 specifically targets the entire low-end space currently handled by 8- and 16-bit microcontrollers, while also hitting the low-end 32-bit space.
“The SAM D20 incorporates high-end support like the high-speed bus matrix linked to three AHB/APB bridges. System and power controllers can be found off one bridge. Memory controllers are found off another,” Wong wrote in an article posted on Electronic Design earlier this year. “The third bridge handles the convention interfaces that include up to six programmable serial ports, eight timers, a 20-channel, 350-ksample/s analog-to-digital converter (ADC), a pair of comparators, and a 10-bit, 350-ksample/s digital-to-analog converter (DAC). There is also Atmel’s touch interface controller.”
Recently, a detailed SAM D20 demo project went live on FreeRTOS.org (FreeRTOS, FreeRTOS+CLI). The demo – which targets Atmel’s SAM D20 Xplained Pro evaluation board – leverages the FreeRTOS ARM Cortex-M0 GCC port and builds with the free Atmel Studio IDE (using the Visual Studio framework and kernel aware FreeRTOS plug-in).
Meanwhile, the command line interface character input and output employs drivers provided Atmel’s Software Framework (ASF), with a #define tasked with switching the build between a simple blinky style application and a comprehensive test/demo application that incorporates the FreeRTOS+CLI component.
Want to build and run the ARM Cortex-M0+ RTOS Application? It should probably be noted that the FreeRTOS download contains the source code for all FreeRTOS ports, so obviously there is a surplus of unneeded files for this specific SAMD20 demo. As such, it might be a good idea to check out the the Source Code Organization section for a description of the directory structure. The Atmel Studio solution file is called RTOSDemo.atsln, which is located in the FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained directory.
Building and running the ARM Cortex-M0+ RTOS application
- Open FreeRTOS/Demo/CORTEX_M0+_Atmel_SAMD20_XPlained/RTOSDemo.atsln in the Atmel Studio IDE.
- Locate the mainCREATE_SIMPLE_BLINKY_DEMO_ONLY definition at the top of main.c.
- Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to 1 to create the simple blinky demo, or 0 to create the comprehensive demo that also includes the command line interpreter.
- Select “Rebuild RTOSDemo” from the Atmel Studio “Build” menu (or press F7) to build the demo project.
- Connect a USB cable between the USB port on the SAMD20 Xplained Pro board and the host computer.
- Select “Start Debugging and Break” from the Atmel Studio “Debug” menu to program the microcontroller flash memory and kick off a debug session.
Interested in learning more about running FreeRTOS on Atmel’s SAM D20 Xplained Pro? Be sure to check out the official FreeRTOS demo here.