SMART ARM-based Microcontrollers AT09886: SAM L22 Getting Started Guide APPLICATION NOTE Introduction This application note aims at helping the reader to get started with the ® ® ® Atmel SAM L22 ARM Cortex -M0+ based Ultra low-power segment LCD microcontroller. Atmel | SMART SAM L22 is a series of Ultra low-power segment LCD microcontrollers using the 32-bit ARM Cortex-M0+ processor, ranging from 48- to 100-pins with up to 256KB Flash and 32KB of SRAM and to drive up to 320 LCD segments. The SAM L22 devices operate at a maximum frequency of 32MHz and reach 2.14 Coremark/ MHz. With sophisticated power management technologies the SAM L22 devices run below 50μA/MHz in active mode and below 600nA in ultra-low-power backup mode with RTC. SAM L22 is targeted for segment LCD and/or Battery powered applications, like sport watches, personal healthcare devices, thermostat with user interface, access control panels and metering (gas, water, energy metering, and basic smart meter) applications. Features • • Getting started with Atmel SAM L22 microcontrollers Getting started with Atmel SAM L22 tools (Atmel SAM L22 Xplained PRO, Atmel Software Framework 3.26.10 or later, and Atmel Studio 6.2 or later) Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 Table of Contents Introduction......................................................................................................................1 Features.......................................................................................................................... 1 1. Configuration Summary............................................................................................. 3 2. Getting the Device Datasheet....................................................................................4 3. Get the SAM L22 Xplained Pro Evaluation Kit...........................................................5 4. Get the Tools..............................................................................................................7 4.1. 4.2. 4.3. 4.4. 4.5. Get Atmel Studio 6....................................................................................................................... 7 Get IAR Embedded Workbench for ARM..................................................................................... 7 Get SAM L22 Xplained Pro Embedded Debugger Software (Segger J-Link).............................. 7 Get Atmel Software Framework (ASF)......................................................................................... 7 Atmel Studio 6.2 Users Getting Started........................................................................................7 5. What’s Next?............................................................................................................11 6. Revision History.......................................................................................................12 Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 2 1. Configuration Summary Table 1-1 Comparison Between SAM L22, SAM L21, and SAM D21 on page 3 shows the difference between SAM L22, SAM L21, and SAM D21 features. For more details, refer to the datasheet of the respective products. Table 1-1 Comparison Between SAM L22, SAM L21, and SAM D21 Features SAM L22N SAM L22J SAM L22G SAM L21J SAM L21G SAM L21E SAM D21J SAM D21G SAM D21E Pins 100 64 48 64 48 32 64 48 32 GPIO(s) 82 50 36 51 37 25 52 26 26 Flash 256/128/64KB 256/128/64KB 256/128/64KB 256/128/64KB 256/128/64KB 256/128/64/32KB 256/128/64/32KB 256/128/64/32KB 256/128/64/32KB Flash RWW section 8/4/2KB 8/4/2KB 8/4/2KB 8/4/2KB 8/4/2KB 8/4/2/1KB 2KB/ 1KB in 2KB/ 1KB in 2KB/ 1KB in 32KB and 64KB 32KB and 64KB 32KB and 64KB Flash variants Flash variants Flash variants System SRAM 32/16/8KB 32/16/8KB 32/16/8KB 32/16/8KB 32/16/8KB 32/16/8/4KB 32/16/8/4KB 32/16/8/4KB 32/16/8/4KB Low Power SRAM - - - 8/8/4KB 8/8/4KB 8/8/4/2KB - - - Segment LCD (SLCD) Pins 48 31 23 - - - - - - Timer Counter (TC) 4 4 4 5 3 3 5 3 3 Timer Counter for Control (TCC) 1 1 1 3 3 3 3 3 3 DMA channels 16 16 16 16 16 16 12 12 12 USB interface 1 1 1 1 1 1 1 1 1 AES engine 1 1 1 1 1 1 - - - Configurable Custom Logic (CCL) (LUTs) 4 4 4 4 4 4 - - - True Random Generator 1 (TRNG) 1 1 1 1 1 - - - SERCOM 6 4 3 6 6 4 6 6 4 ADC channels 20 16 10 20 14 10 20 14 10 Analog Comparators 2 2 2 2 2 2 2 2 2 DAC Channels - - - 2 2 2 1 1 1 Op-Amp - - - 3 3 3 - - - Tamper Input Pins 5 3 2 - - - RTC Yes Yes Yes Yes Yes Yes Yes Yes Yes RTC alarms 1 1 1 1 1 1 1 1 1 External Interrupt lines 16 16 16 16 16 16 16 16 16 PTC channels for mutual 256 (16x16) capacitance 182 (13x14) 110 (10x11) 12x16 16x12 8x12 12x8 6x10 10x6 16x16 12x10 10x6 PTC channels for self capacitance 24 19 13 16 12 10 16 16 6 Maximum CPU frequency 32MHz 32MHz 32MHz 48MHz 48MHz 48MHz 48MHz 48MHz 48MHz Packages TQFP QFN TQFP QFN TQFP QFN TQFP QFN TQFP QFN TQFP QFN TQFP QFN TQFP QFN TQFP Event System channels 8 8 8 12 12 12 12 12 12 SW Debug Interface Yes Yes Yes Yes Yes Yes Yes Yes Yes WDT Yes Yes Yes Yes Yes Yes Yes Yes Yes Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 3 2. Getting the Device Datasheet Web page: http://www.atmel.com/products/microcontrollers/arm/sam-l.aspx?tab=documents Document: Atmel SAM L22 Datasheet (summary, complete) (.pdf) Select the latest datasheet (.pdf file). There are two versions: • • Complete version (includes all peripheral descriptions and electrical characteristics) Summary version (includes Ordering Information, pinout and Packaging Information) Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 4 3. Get the SAM L22 Xplained Pro Evaluation Kit Web page: http://www.atmel.com/products/microcontrollers/arm/sam-l.aspx?tab=tools Get the kit: http://store.atmel.com Figure 3-1 SAML22 Xplained Pro Picture Document: • SAM L22 Xplained Pro User Guide application note (.pdf) available in http://www.atmel.com/tools/ ATSAML22-XPRO.aspx?tab=documents Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 5 Key features: • • • • • • • ATSAML22N18A microcontroller One mechanical reset button One user button (wake-up, bootloader entry or general purpose) One Yellow user LED (LED0) USB Device interface function ® One QTouch Button Segment LCD connector with additional lines for touch • • • • • • • ATAES132 Crypto Authentication 32.768kHz crystal Standard Cortex Debug connector 3 Xplained Pro extension headers (EXT1, EXT2, and EXT3) USB powered Supported with application examples in Atmel Software Framework Embedded Debugger – Auto ID for board identification in Atmel Studio 6.2 – Programming/debugging of target via SWD – Data gateway interface to target (SPI & TWI) – Four GPIOs connected to target – One yellow EDBG status LED – One green board power LED (controlled by EDBG) – Virtual COM-port interface via UART Embedded current measurement circuitry, with Atmel Data Visualizer support for data visualization Arduino extension footprint The SAM L22 Xplained Pro User Guide application note covers how to power the kit, the detailed information of the on board components, extension interface and the hardware guide. • • Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 6 4. Get the Tools Atmel Studio 6.2 is the preferred IDE to get started with the SAM L22 device and GCC compiler. Atmel ™ Software Framework (ASF) provides SAM L22 peripheral drivers and example projects. IAR compiler is supported as well. 4.1. Get Atmel Studio 6 Web page: www.atmel.com/atmelstudio Document/ file: • Atmel Studio 6.2 installer (.exe) Atmel Studio 6.2 is the IDE for developing and debugging firmware for the SAM L22 microcontroller. 4.2. Get IAR Embedded Workbench for ARM Web page: http://www.iar.com/en/Products/IAR-Embedded-Workbench/ARM/ Document/file: • 4.3. IAR installer for ARM Get SAM L22 Xplained Pro Embedded Debugger Software (Segger J-Link) Web page: http://www.segger.com/jlink-software.html Document/file: • J-Link software This software is required to program/debug the SAM L22 Xplained Pro embedded debugger with IAR IDE. 4.4. Get Atmel Software Framework (ASF) Web page: www.atmel.com/asf Document/file: • • • • • • • 4.5. ASF update for Atmel Studio (.vsix) from ASF web page ASF update through Atmel Gallery https://gallery.atmel.com/ for version 3.26.10 and above ASF update through Tools>Extension Manager from Atmel Studio ASF standalone package for GCC makefile and IAR users ASF: Getting started (.pdf) ASF: Reference Manual (.pdf) ASF online documentation for available API and examples can be found at http://asf.atmel.com Atmel Studio 6.2 Users Getting Started Prerequisites: Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 7 • • • Atmel Studio 6.2 SP2 or above installed ASF version 3.26.10 or above installed SAM L22 Xplained Pro board connected to PC through embedded debugger USB connector. The kit is powered through USB. Getting started with Atmel Studio 6.2, ASF, and SAM L22 Xplained Pro: • • • Launch Atmel Studio 6.2 Connect the SAM L22 Xplained Pro board to the PC using a USB cable A page on SAM L22 Xplained Pro description will open in Atmel Studio • This page contains external link to Device Technical Documentation, Datasheet, Kit user guide, and Kit specific details like serial number and target name. Also, there will be an option to open ASF example projects. To open ASF examples, click File-> New -> then Example Project. • Figure 4-1 Creating New Example Project in Atmel Studio • Select ‘Getting started application-SAM L22 Xplained Pro’ as shown in Figure 4-2 SAML22 Getting started Project Selection on page 9, press OK and accept the license agreement. Then the project will be created and opened Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 8 Figure 4-2 SAML22 Getting started Project Selection • • Open project properties (Project -> Properties or shortcut Alt+f7) In Tool view, set ‘Select debugger/programmer’ to XPRO-EDBG and interface to SWD as shown in Figure 4-3 SAML22 Atmel Studio – Tools Configuration on page 9 Figure 4-3 SAML22 Atmel Studio – Tools Configuration • Build the project: Build -> Build solution or shortcut F7 Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 9 • • • • • • To load the code in the SAM L22 Xplained Pro and debug, select Debug -> Start debugging and break (shortcut Alt + F5) The application is programmed and the debugger breaks in main To run the code, select Debug -> Continue (shortcut F5) ® On the computer, open and configure a terminal application (e.g. HyperTerminal on Microsoft ® Windows or Terminal application is available as an addon to Atmel Studio) with these settings: – 38400 bauds – 8 bits of data – No parity – 1 stop bit – No flow control Start the application The LED should start blinking on the board. In the terminal window, the following text should appear (values depend on the board and chip used): – \code • Getting Started Example xxx -• xxxxxx-xx • Compiled: xxx xx xxxx xx:xx:xx -– \endcode • Figure 4-4 SAML22 Getting Started – Terminal Output • Pressing and release button SW0 should make LED0 on and off blinking. Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 10 5. What’s Next? • • • • • • • Atmel Studio videos: www.atmel.com/atmelstudio Atmel Studio help: Help -> View Help (Ctrl+F1) ASF Getting Started: www.atmel.com/asf ASF online documentation: http://asf.atmel.com/docs/latest/ ASF Reference manual: http://www.atmel.com/tools/AVRSOFTWAREFRAMEWORK.aspx? tab=documents Technical Documentation for various products: www.atmel.no/webdoc Technical Support: http://www.atmel.com/design-support/ . Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 11 6. Revision History Doc Rev. Date Comments 42494A 08/2015 Initial document release. Atmel AT09886: SAM L22 Getting Started Guide [APPLICATION NOTE] Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 12 Atmel Corporation © 1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441.0311 F: (+1)(408) 436.4200 | www.atmel.com 2015 Atmel Corporation. / Rev.: Atmel-42494A-SAML22-Getting-Started-Guide_AT9886_Application Note-08/2015 ® ® ® ® Atmel , Atmel logo and combinations thereof, Enabling Unlimited Possibilities , AVR , QTouch , and others are registered trademarks or trademarks of Atmel ® ® ® Corporation in U.S. and other countries. ARM , ARM Connected logo and others are the registered trademarks or trademarks of ARM Ltd. Windows is a registered trademark of Microsoft Corporation in U.S. and or other countries. Other terms and product names may be trademarks of others. DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in connection with any applications where the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety-Critical Applications”) without an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environments unless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specifically designated by Atmel as automotive-grade.