The ATSAMD20J17A-AU operates as a complete 32-bit embedded microcontroller system on a single chip, integrating the ARM Cortex-M0+ processor core with Flash memory, SRAM, and a comprehensive set of flexible peripherals.
ARM Cortex-M0+ Core: The Cortex-M0+ is a 32-bit RISC processor implementing the ARMv6-M architecture with the Thumb instruction set. It features a 2-stage pipeline (fewer stages than the Cortex-M0 3-stage pipeline) for improved power efficiency. The M0+ includes a single-cycle hardware multiplier (32×32 to 32-bit result), a nested vectored interrupt controller (NVIC) with configurable priority levels, and a Micro Trace Buffer (MTB) for instruction trace. The core achieves 2.46 CoreMark/MHz, providing approximately 118 CoreMark at 48 MHz.
Memory System: The 128 KB Flash stores program code and constant data, organized as 512-byte pages for erase operations. The Flash supports in-system programming (ISP) via SWD and in-application programming (IAP) for firmware updates. The Flash wait states are automatically managed by the NVMCTRL based on the CPU frequency. The 16 KB SRAM is organized as a single bank with single-cycle access at 48 MHz. The SRAM is organized as two sections: the first 8 KB is bit-bandable and can be retained in standby mode, while the remaining 8 KB is not retained.
Clock System: The clock system is highly flexible with multiple sources. The internal 8 MHz RC oscillator (OSC8M) provides a default clock at startup. The DFLL48M (Digital Frequency Locked Loop) can multiply the 32 kHz reference to 48 MHz with high accuracy. The FDPLL96M (Fractional Digital Phase Locked Loop) can generate frequencies from 48 MHz to 96 MHz from various reference sources. External crystal oscillators (XOSC32K for 32.768 kHz RTC crystal, XOSC for 0.4-32 MHz main crystal) provide precise timing. The clock system supports dynamic clock switching and glitch-free frequency transitions.
SERCOM Modules: Each of the six SERCOM modules is a universal serial communication peripheral that can be configured as USART, I2C, or SPI. The configuration is set through registers and can be changed at runtime (with proper de-initialization). Each SERCOM has its own interrupt, DMA trigger, and clock domain. The I2C mode supports Standard (100 kHz), Fast (400 kHz), and High-Speed modes. The SPI mode supports master and slave operation with configurable clock polarity and phase. The USART mode supports full-duplex, half-duplex, and LIN protocol with fractional baud rate generation.
Event System: The 8-channel event system connects event generators (timers, ADC, EIC, etc.) to event users (ADC triggers, DMA requests, timer actions, etc.) without CPU intervention. Events are transmitted in 1-2 clock cycles, much faster than interrupt-driven handling. The event system operates even in standby sleep mode, enabling SleepWalking peripherals. For example, the RTC can generate a periodic event that triggers the ADC to sample a sensor, and if the ADC result exceeds a threshold (via the analog comparator window function), the CPU is woken from standby.
ADC Operation: The 12-bit ADC supports single-ended and differential input modes. In differential mode, the positive and negative inputs can be any of the 20 ADC channels, providing maximum flexibility. The programmable gain stage (1/2x to 16x) amplifies small signals before conversion, improving the effective resolution for low-amplitude sensors. The hardware oversampling accumulates 2^N samples and divides by 2^N to achieve N/2 bits of additional resolution (e.g., 4x oversampling gives 13-bit effective resolution). The offset and gain error compensation automatically corrects systematic ADC errors using factory-calibrated or user-programmed correction values.
Power Management: The SAM D20 supports multiple sleep modes. Idle mode stops the CPU but keeps peripherals running; any interrupt wakes the CPU. Standby mode stops the CPU, most clocks, and Flash; only the RTC, EIC, and event system remain active; SRAM can be retained (first 8 KB); wakeup sources include external interrupts, RTC alarm, and touch detection; current consumption is approximately 3 uA in standby with RTC running. SleepWalking allows peripherals like the ADC and SERCOM to operate briefly in standby mode, triggered by events, without waking the CPU.
Debug Interface: The 2-pin SWD interface (SWDIO, SWCLK) provides debug access and Flash programming. The Micro Trace Buffer (MTB) records the last 256-4096 executed instructions in a circular buffer in SRAM, providing basic instruction trace capability without requiring an external trace port.