AT03262: SAM D/R/L/C System Pin Multiplexer (SYSTEM PINMUX) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

Similar documents
AT10942: SAM Configurable Custom Logic (CCL) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

AT11512: SAM L Brown Out Detector (BOD) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

APPLICATION NOTE. Atmel AT03261: SAM D20 System Interrupt Driver (SYSTEM INTERRUPT) SAM D20 System Interrupt Driver (SYSTEM INTERRUPT)

SAM4 Reset Controller (RSTC)

APPLICATION NOTE. AT05567: TC Capture on External Interrupt with the Event System on SAM D20. Preface ASF PROJECT DOCUMENTATION

APPLICATION NOTE. AT06863: SAM4L Peripheral Event Controller (PEVC) SAM4L Peripheral Event Controller (PEVC) ASF PROGRAMMERS MANUAL

AVR42789: Writing to Flash on the New tinyavr Platform Using Assembly

AT60142H/HT. Rad-Hard 512Kx8 Very Low Power CMOS SRAM ERRATA-SHEET. Active Errata List. Errata History. Abbreviations. 1.

AT03975: Getting Started with SAM L21. Descripton. Features. SMART ARM-Based Microcontroller APPLICATION NOTE

AT07942: SAM4L Asynchronous Timer (AST) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

AT09381: SAM D - Debugging Watchdog Timer Reset. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

APPLICATION NOTE. AT6486: Using DIVAS on SAMC Microcontroller. SMART ARM-Based Microcontroller. Introduction. Features

SAM4L Asynchronous Timer (AST)

AT06467: Getting started with SAM D09/D10/D11. Features. Description. SMART ARM-based Microcontrollers APPLICATION NOTE

ATAES132A Firmware Development Library. Introduction. Features. Atmel CryptoAuthentication USER GUIDE

AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE

AT21CS Series Reset and Discovery. Introduction. Serial EEPROM APPLICATION NOTE

EDBG. Description. Programmers and Debuggers USER GUIDE

USER GUIDE. Atmel QT6 Xplained Pro. Preface

QT3 Xplained Pro. Preface. Atmel QTouch USER GUIDE

APPLICATION NOTE. 3-lead CONTACT Package Usage. ATSHA204A, ATECC108A, and ATECC508A. Introduction. 3-lead CONTACT Package

AVR42772: Data Logger Demo Application on XMEGA A1U Xplained Pro. Introduction. Features. AVR XMEGA Microcontrollers APPLICATION NOTE

This user guide describes how to run the Atmel ATWINC3400 Bluetooth Low Energy (BLE) Provisioning demo from out-of-box conditions.

Ethernet1 Xplained Pro

APPLICATION NOTE. AT11008: Migration from ATxmega16D4/32D4 Revision E to Revision I. Atmel AVR XMEGA. Introduction. Features

APPLICATION NOTE. Generating Random Secrets. ATSHA204A, ATECC108A, and ATECC508A. Description. Topics

ATECC108/ATSHA204 USER GUIDE. Atmel Firmware Library. Features. Introduction

DGILib USER GUIDE Atmel-42771A-DGILib_User Guide-09/2016

QT2 Xplained Pro. Preface. Atmel QTouch USER GUIDE

SAM4L Liquid Crystal Display (LCDCA)

APPLICATION NOTE. AT04470: Differences between SAM D21 Variants A, B, and L. 32-bit Microcontroller. Introduction

APPLICATION NOTE. Atmel QT4 Xplained Pro User Guide ATAN0114. Preface

SAMA5D2 Quad SPI (QSPI) Performance. Introduction. SMART ARM-based Microprocessor APPLICATION NOTE

ATECC508A Public Key Validation. Introduction. Atmel CryptoAuthentication APPLICATION NOTE

APPLICATION NOTE. CryptoAuthentication Personalization Guide. ATSHA204A and ATECC508A. Introduction. Features

APPLICATION NOTE. How to Securely Switch Atmel s LIN Transceiver ATA6662/ATA6662C to Sleep Mode ATA6662/ATA6662C. Concerning Atmel ATA6662

AT88CK101 HARDWARE USER GUIDE. Atmel CryptoAuthentication Development Kit. Atmel CryptoAuthentication AT88CK101 Daughterboard

ATtiny817 QTouch Moisture Demo User Guide. Description. Features. AVR 8-bit Microcontrollers USER GUIDE

USER GUIDE. ATWINC1500 Xplained Pro. Preface

APPLICATION NOTE. Atmel AT02260: Driving AT42QT1085. Atmel QTouch. Features. Description

USER GUIDE. Atmel QT1 Xplained Pro. Preface

Smart RF Device Family - Getting Started Guide. Features. Description. References ATAN0115 APPLICATION NOTE

APPLICATION NOTE. Scope. Reference Documents. Software Ethernet Bridge on SAMA5D3/D4. Atmel SMART SAMA5D3/D4 Series

Native route discovery algorithm

Atmel AVR32847: Migration from/to the UC3L0 64/32/16 from/to the UC3L0 256/ bit Atmel Microcontrollers. Application Note.

ATtiny104 Xplained Nano. Preface. AVR 8-bit Microcontrollers USER GUIDE

USER GUIDE EDBG. Description

USER GUIDE. Atmel Segment LCD1 Xplained Pro. Preface

AT03255: SAM D/R/L/C Serial Peripheral Interface (SERCOM SPI) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

APPLICATION NOTE. Atmel AT03304: SAM D20 I 2 C Slave Bootloader SAM D20. Description. Features

USER GUIDE. Atmel OLED1 Xplained Pro. Preface

APPLICATION NOTE. Atmel AT01080: XMEGA E Schematic Checklist. Atmel AVR XMEGA E. Features. Introduction

Hardware Prerequisites Atmel Xplained Pro Evaluation Kit Atmel WINC1500 extension USB Micro Cable (TypeA / MicroB)

APPLICATION NOTE. Atmel AVR3009: Driving QTouch Device with I 2 C Interface. Atmel QTouch. Introduction

APPLICATION NOTE. AT03324: Atmel REB212BSMA-EK Quick Start Guide. Atmel MCU Wireless. Introduction

APPLICATION NOTE. Atmel AVR1638: XMEGA RTC Calibration. 8-bit Atmel Microcontrollers. Features. Introduction

I/O1 Xplained Pro. Preface. Atmel MCUs USER GUIDE

APPLICATION NOTE. Atmel AT03160: Migrating Bootloader from ATxmega128A1 to other Atmel XMEGA Devices. Atmel AVR XMEGA. Features.

Intel Stress Bitstreams and Encoder (Intel SBE) 2017 AVS2 Release Notes (Version 2.3)

APPLICATION NOTE. AT07216: SAM G55 Schematic Checklist. Atmel SMART SAM G55. Introduction

a clock signal and a bi-directional data signal (SCL, SDA)

64K (8K x 8) Battery-Voltage Parallel EEPROM with Page Write and Software Data Protection AT28BV64B

AVR1518: XMEGA-A1 Xplained Training - XMEGA Clock System. 8-bit Atmel Microcontrollers. Application Note. Prerequisites.

USER GUIDE. Atmel maxtouch Xplained Pro. Preface

AVR1303: Use and configuration of IR communication module. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

OLED display with pixels resolution Ambient light sensor CPU load Analog filter Quadrature Encoder with push button Digital I/O

AVR32752: Using the AVR32 UC3 Static Memory Controller. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

Section 5 SERCOM. Tasks SPI. In this section you will learn:

SMART ARM-based Microcontrollers ATSAMD21E16LMOTOR USER GUIDE

HALCoGen TMS570LS31x Help: example_sci_uart_9600.c

Application Note Using the ATV750, ATV750B, and ATF750C Erasable Programmable Logic Device Introduction 1.1 Device Names and Pin/Node Assignments

USER GUIDE. Atmel PROTO1 Xplained Pro. Preface

End User License Agreement

Ecma International Policy on Submission, Inclusion and Licensing of Software

Atmel AVR1619: XMEGA-B1 Xplained Demonstration. 8-bit Atmel Microcontrollers. Application Note. Features. 1 Introduction

Open Source Used In TSP

US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

AVR1503: Xplain training - XMEGA Programmable Multi Interrupt Controller 8-bit Microcontrollers Application Note Prerequisites

Copyright PFU LIMITED

RELEASE NOTES. GNU Toolchain for Atmel ARM Embedded Processors. Introduction

Documentation Roadmap for Cisco Prime LAN Management Solution 4.2

Copyright PFU LIMITED 2016

AT88RF04C. CryptoRF EEPROM Memory 13.56MHz, 4 Kilobits SUMMARY DATASHEET. Features

APPLICATION NOTE. Atmel AVR057: Internal RC Oscillator Calibration for ATtiny4/5/9/10/20/40. 8-bit Atmel Microcontrollers. Features.

AT88SC3216CRF. CryptoRF EEPROM Memory 13.56MHz, 32 Kilobits SUMMARY DATASHEET. Features

MySonicWall Secure Upgrade Plus

APPLICATION NOTE. Atmel AT03782: Using Low Power Modes in SAM4N Microcontroller. Atmel 32-bit Microcontroller. Features.

Ecma International Policy on Submission, Inclusion and Licensing of Software

AVR1501: Xplain training XMEGA Timer/Counter 8-bit Microcontrollers Application Note Prerequisites 1 Introduction

AN2667 Application note

ATZB-SAMR21-XPRO. Preface. SmartConnect USER GUIDE

APPLICATION NOTE. Atmel AVR536: Migration from ATmega644 to ATmega644A. 8-bit Atmel Microcontrollers. Introduction

Fujitsu ScandAll PRO V2.1.5 README

Atmel ATtiny1634 MCU Atmel ATA SBC LIN transceiver with integrated voltage regulator Touch. Three Atmel QTouch buttons One Atmel QTouch slider

Atmel QT600 Quick Start Guide Touch Solutions

DATASHEET 4D SYSTEMS. 4D Raspberry Pi Serial Adaptor TURNING TECHNOLOGY INTO ART. 4D-Serial-Pi-Adaptor

AVR1315: Accessing the XMEGA EEPROM. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Mile Terms of Use. Effective Date: February, Version 1.1 Feb 2018 [ Mile ] Mileico.com

M3H Group(2) Application Note 12-bit Analog to Digital Converter (ADC-A)

DATASHEET 4D SYSTEMS. 4D Arduino Adaptor Shield TURNING TECHNOLOGY INTO ART. 4Display-Adaptor-Shield

Transcription:

SMART ARM-based Microcontrollers AT03262: SAM D/R/L/C System Pin Multiplexer (SYSTEM PINMUX) Driver APPLICATION NOTE Introduction This driver for Atmel SMART ARM -based microcontrollers provides an interface for the configuration and management of the device's physical I/O Pins, to alter the direction and input/drive characteristics as well as to configure the pin peripheral multiplexer selection. The following peripheral is used by this module: PORT (Port I/O Management) The following devices can use this module: Atmel SMART SAM D20/D21 Atmel SMART SAM R21 Atmel SMART SAM D09/D10/D11 Atmel SMART SAM L21/L22 Atmel SMART SAM DA1 Atmel SMART SAM C20/C21 The outline of this documentation is as follows: Prerequisites Module Overview Special Considerations Extra Information Examples API Overview

Table of Contents Introduction...1 1. Software License... 4 2. Prerequisites...5 3. Module Overview...6 3.1. Driver Feature Macro Definition...6 3.2. Physical and Logical GPIO Pins...6 3.3. Peripheral Multiplexing... 6 3.4. Special Pad Characteristics...6 3.4.1. Drive Strength...6 3.4.2. Slew Rate... 6 3.4.3. Input Sample Mode...7 3.5. Physical Connection...7 4. Special Considerations...8 5. Extra Information... 9 6. Examples...10 7. API Overview... 11 7.1. Structure Definitions... 11 7.1.1. Struct system_pinmux_config... 11 7.2. Macro Definitions...11 7.2.1. Macro FEATURE_SYSTEM_PINMUX_DRIVE_STRENGTH... 11 7.2.2. Macro SYSTEM_PINMUX_GPIO... 11 7.3. Function Definitions... 11 7.3.1. Configuration and Initialization...11 7.3.2. Special Mode Configuration (Physical Group Orientated)... 13 7.3.3. Special Mode Configuration (Logical Pin Orientated)...13 7.3.4. Function system_pinmux_group_set_output_strength()...14 7.3.5. Function system_pinmux_pin_set_output_strength()... 14 7.4. Enumeration Definitions... 15 7.4.1. Enum system_pinmux_pin_dir...15 7.4.2. Enum system_pinmux_pin_pull... 15 7.4.3. Enum system_pinmux_pin_sample... 15 7.4.4. Enum system_pinmux_pin_strength...16 8. Extra Information for SYSTEM PINMUX Driver...17 8.1. Acronyms...17 8.2. Dependencies...17 8.3. Errata...17 8.4. Module History...17 2

9. Examples for SYSTEM PINMUX Driver... 18 9.1. Quick Start Guide for SYSTEM PINMUX - Basic... 18 9.1.1. Setup... 18 9.1.2. Use Case... 19 10. Document Revision History... 20 3

1. Software License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of Atmel may not be used to endorse or promote products derived from this software without specific prior written permission. 4. This software may only be redistributed and used in connection with an Atmel microcontroller product. THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 4

2. Prerequisites There are no prerequisites for this module. 5

3. Module Overview The SAM devices contain a number of General Purpose I/O pins, used to interface the user application logic and internal hardware peripherals to an external system. The Pin Multiplexer (PINMUX) driver provides a method of configuring the individual pin peripheral multiplexers to select alternate pin functions. 3.1. Driver Feature Macro Definition Driver Feature Macro FEATURE_SYSTEM_PINMUX_DRIVE_STRENGTH Supported devices SAM L21, SAM C20/C21 Note: The specific features are only available in the driver when the selected device supports those features. 3.2. Physical and Logical GPIO Pins SAM devices use two naming conventions for the I/O pins in the device; one physical and one logical. Each physical pin on a device package is assigned both a physical port and pin identifier (e.g. "PORTA. 0") as well as a monotonically incrementing logical GPIO number (e.g. "GPIO0"). While the former is used to map physical pins to their physical internal device module counterparts, for simplicity the design of this driver uses the logical GPIO numbers instead. 3.3. Peripheral Multiplexing SAM devices contain a peripheral MUX, which is individually controllable for each I/O pin of the device. The peripheral MUX allows you to select the function of a physical package pin - whether it will be controlled as a user controllable GPIO pin, or whether it will be connected internally to one of several peripheral modules (such as an I 2 C module). When a pin is configured in GPIO mode, other peripherals connected to the same pin will be disabled. 3.4. Special Pad Characteristics There are several special modes that can be selected on one or more I/O pins of the device, which alter the input and output characteristics of the pad. 3.4.1. Drive Strength The Drive Strength configures the strength of the output driver on the pad. Normally, there is a fixed current limit that each I/O pin can safely drive, however some I/O pads offer a higher drive mode which increases this limit for that I/O pin at the expense of an increased power consumption. 3.4.2. Slew Rate The Slew Rate configures the slew rate of the output driver, limiting the rate at which the pad output voltage can change with time. 6

3.4.3. Input Sample Mode The Input Sample Mode configures the input sampler buffer of the pad. By default, the input buffer is only sampled "on-demand", i.e. when the user application attempts to read from the input buffer. This mode is the most power efficient, but increases the latency of the input sample by two clock cycles of the port clock. To reduce latency, the input sampler can instead be configured to always sample the input buffer on each port clock cycle, at the expense of an increased power consumption. 3.5. Physical Connection Figure 3-1 Physical Connection on page 7 shows how this module is interconnected within the device: Figure 3-1. Physical Connection Port Pad Peripheral MUX GPIO Module Other Peripheral Modules 7

4. Special Considerations The SAM port pin input sampling mode is set in groups of four physical pins; setting the sampling mode of any pin in a sub-group of eight I/O pins will configure the sampling mode of the entire sub-group. High Drive Strength output driver mode is not available on all device pins - refer to your device specific datasheet. 8

5. Extra Information For extra information, see Extra Information for SYSTEM PINMUX Driver. This includes: Acronyms Dependencies Errata Module History 9

6. Examples For a list of examples related to this driver, see Examples for SYSTEM PINMUX Driver. 10

7. API Overview 7.1. Structure Definitions 7.1.1. Struct system_pinmux_config Configuration structure for a port pin instance. This structure should be initialized by the system_pinmux_get_config_defaults() function before being modified by the user application. Table 7-1. Members Type Name Description enum system_pinmux_pin_dir enum system_pinmux_pin_pull direction input_pull Port buffer input/output direction Logic level pull of the input buffer uint8_t mux_position MUX index of the peripheral that should control the pin, if peripheral control is desired. For GPIO use, this should be set to SYSTEM_PINMUX_GPIO. bool powersave Enable lowest possible powerstate on the pin Note: All other configurations will be ignored, the pin will be disabled. 7.2. Macro Definitions 7.2.1. Macro FEATURE_SYSTEM_PINMUX_DRIVE_STRENGTH #define FEATURE_SYSTEM_PINMUX_DRIVE_STRENGTH Output Driver Strength Selection feature support 7.2.2. Macro SYSTEM_PINMUX_GPIO #define SYSTEM_PINMUX_GPIO Peripheral multiplexer index to select GPIO mode for a pin 7.3. Function Definitions 7.3.1. Configuration and Initialization 7.3.1.1. Function system_pinmux_get_config_defaults() Initializes a Port pin configuration structure to defaults. void system_pinmux_get_config_defaults( struct system_pinmux_config *const config) 11

Initializes a given Port pin configuration structure to a set of known default values. This function should be called on all new instances of these configuration structures before being modified by the user application. The default configuration is as follows: Non peripheral (i.e. GPIO) controlled Input mode with internal pull-up enabled Table 7-2. Parameters Data direction Parameter name Description [out] config Configuration structure to initialize to default values 7.3.1.2. Function system_pinmux_pin_set_config() Writes a Port pin configuration to the hardware module. void system_pinmux_pin_set_config( const uint8_t gpio_pin, const struct system_pinmux_config *const config) Writes out a given configuration of a Port pin configuration to the hardware module. Note: If the pin direction is set as an output, the pull-up/pull-down input configuration setting is ignored. Table 7-3. Parameters Data direction Parameter name Description [in] gpio_pin Index of the GPIO pin to configure [in] config Configuration settings for the pin 7.3.1.3. Function system_pinmux_group_set_config() Writes a Port pin group configuration to the hardware module. void system_pinmux_group_set_config( PortGroup *const port, const uint32_t mask, const struct system_pinmux_config *const config) Writes out a given configuration of a Port pin group configuration to the hardware module. Note: If the pin direction is set as an output, the pull-up/pull-down input configuration setting is ignored. Table 7-4. Parameters Data direction Parameter name Description [in] port Base of the PORT module to configure [in] mask Mask of the port pin(s) to configure [in] config Configuration settings for the pin 12

7.3.2. Special Mode Configuration (Physical Group Orientated) 7.3.2.1. Function system_pinmux_get_group_from_gpio_pin() Retrieves the PORT module group instance from a given GPIO pin number. PortGroup * system_pinmux_get_group_from_gpio_pin( const uint8_t gpio_pin) Retrieves the PORT module group instance associated with a given logical GPIO pin number. Table 7-5. Parameters Data direction Parameter name Description [in] gpio_pin Index of the GPIO pin to convert Returns Base address of the associated PORT module. 7.3.2.2. Function system_pinmux_group_set_input_sample_mode() Configures the input sampling mode for a group of pins. void system_pinmux_group_set_input_sample_mode( PortGroup *const port, const uint32_t mask, const enum system_pinmux_pin_sample mode) Configures the input sampling mode for a group of pins, to control when the physical I/O pin value is sampled and stored inside the microcontroller. Table 7-6. Parameters Data direction Parameter name Description [in] port Base of the PORT module to configure [in] mask Mask of the port pin(s) to configure [in] mode New pin sampling mode to configure 7.3.3. Special Mode Configuration (Logical Pin Orientated) 7.3.3.1. Function system_pinmux_pin_get_mux_position() Retrieves the currently selected MUX position of a logical pin. uint8_t system_pinmux_pin_get_mux_position( const uint8_t gpio_pin) Retrieves the selected MUX peripheral on a given logical GPIO pin. Table 7-7. Parameters Data direction Parameter name Description [in] gpio_pin Index of the GPIO pin to configure 13

Returns Currently selected peripheral index on the specified pin. 7.3.3.2. Function system_pinmux_pin_set_input_sample_mode() Configures the input sampling mode for a GPIO pin. void system_pinmux_pin_set_input_sample_mode( const uint8_t gpio_pin, const enum system_pinmux_pin_sample mode) Configures the input sampling mode for a GPIO input, to control when the physical I/O pin value is sampled and stored inside the microcontroller. Table 7-8. Parameters Data direction Parameter name Description [in] gpio_pin Index of the GPIO pin to configure [in] mode New pin sampling mode to configure 7.3.4. Function system_pinmux_group_set_output_strength() Configures the output driver strength mode for a group of pins. void system_pinmux_group_set_output_strength( PortGroup *const port, const uint32_t mask, const enum system_pinmux_pin_strength mode) Configures the output drive strength for a group of pins, to control the amount of current the pad is able to sink/source. Table 7-9. Parameters Data direction Parameter name Description [in] port Base of the PORT module to configure [in] mask Mask of the port pin(s) to configure [in] mode New output driver strength mode to configure 7.3.5. Function system_pinmux_pin_set_output_strength() Configures the output driver strength mode for a GPIO pin. void system_pinmux_pin_set_output_strength( const uint8_t gpio_pin, const enum system_pinmux_pin_strength mode) Configures the output drive strength for a GPIO output, to control the amount of current the pad is able to sink/source. 14

Table 7-10. Parameters Data direction Parameter name Description [in] gpio_pin Index of the GPIO pin to configure [in] mode New output driver strength mode to configure 7.4. Enumeration Definitions 7.4.1. Enum system_pinmux_pin_dir Enum for the possible pin direction settings of the port pin configuration structure, to indicate the direction the pin should use. Table 7-11. Members Enum value SYSTEM_PINMUX_PIN_DIR_INPUT SYSTEM_PINMUX_PIN_DIR_OUTPUT Description The pin's input buffer should be enabled, so that the pin state can be read The pin's output buffer should be enabled, so that the pin state can be set (but not read back) SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK The pin's output and input buffers should both be enabled, so that the pin state can be set and read back 7.4.2. Enum system_pinmux_pin_pull Enum for the possible pin pull settings of the port pin configuration structure, to indicate the type of logic level pull the pin should use. Table 7-12. Members Enum value SYSTEM_PINMUX_PIN_PULL_NONE SYSTEM_PINMUX_PIN_PULL_UP SYSTEM_PINMUX_PIN_PULL_DOWN Description No logical pull should be applied to the pin Pin should be pulled up when idle Pin should be pulled down when idle 7.4.3. Enum system_pinmux_pin_sample Enum for the possible input sampling modes for the port pin configuration structure, to indicate the type of sampling a port pin should use. 15

Table 7-13. Members Enum value Description SYSTEM_PINMUX_PIN_SAMPLE_CONTINUOUS Pin input buffer should continuously sample the pin state SYSTEM_PINMUX_PIN_SAMPLE_ONDEMAND Pin input buffer should be enabled when the IN register is read 7.4.4. Enum system_pinmux_pin_strength Enum for the possible output drive strengths for the port pin configuration structure, to indicate the driver strength the pin should use. Table 7-14. Members Enum value SYSTEM_PINMUX_PIN_STRENGTH_NORMAL SYSTEM_PINMUX_PIN_STRENGTH_HIGH Description Normal output driver strength High current output driver strength 16

8. Extra Information for SYSTEM PINMUX Driver 8.1. Acronyms The table below presents the acronyms used in this module: Acronym GPIO MUX Description General Purpose Input/Output Multiplexer 8.2. Dependencies This driver has the following dependencies: None 8.3. Errata There are no errata related to this driver. 8.4. Module History An overview of the module history is presented in the table below, with details on the enhancements and fixes made to the module since its first release. The current version of this corresponds to the newest version in the table. Changelog Removed code of open drain, slew limit and drive strength features Fixed broken sampling mode function implementations, which wrote corrupt configuration values to the device registers Added missing NULL pointer asserts to the PORT driver functions Initial Release 17

9. Examples for SYSTEM PINMUX Driver This is a list of the available Quick Start guides (QSGs) and example applications for SAM System Pin Multiplexer (SYSTEM PINMUX) Driver. QSGs are simple examples with step-by-step instructions to configure and use this driver in a selection of use cases. Note that a QSG can be compiled as a standalone application or be added to the user application. Quick Start Guide for SYSTEM PINMUX - Basic 9.1. Quick Start Guide for SYSTEM PINMUX - Basic 9.1.1. Setup In this use case, the PINMUX module is configured for: One pin in input mode, with pull-up enabled, connected to the GPIO module Sampling mode of the pin changed to sample on demand This use case sets up the PINMUX to configure a physical I/O pin set as an input with pull-up and changes the sampling mode of the pin to reduce power by only sampling the physical pin state when the user application attempts to read it. 9.1.1.1. Prerequisites 9.1.1.2. Code There are no special setup requirements for this use-case. Copy-paste the following setup code to your application: 9.1.1.3. Workflow struct system_pinmux_config config_pinmux; system_pinmux_get_config_defaults(&config_pinmux); config_pinmux.mux_position = SYSTEM_PINMUX_GPIO; config_pinmux.direction = SYSTEM_PINMUX_PIN_DIR_INPUT; config_pinmux.input_pull = SYSTEM_PINMUX_PIN_PULL_UP; system_pinmux_pin_set_config(10, &config_pinmux); 1. Create a PINMUX module pin configuration struct, which can be filled out to adjust the configuration of a single port pin. struct system_pinmux_config config_pinmux; 2. Initialize the pin configuration struct with the module's default values. system_pinmux_get_config_defaults(&config_pinmux); Note: This should always be performed before using the configuration struct to ensure that all values are initialized to known default settings. 3. Adjust the configuration struct to request an input pin with pull-up connected to the GPIO peripheral. config_pinmux.mux_position = SYSTEM_PINMUX_GPIO; config_pinmux.direction = SYSTEM_PINMUX_PIN_DIR_INPUT; config_pinmux.input_pull = SYSTEM_PINMUX_PIN_PULL_UP; 18

4. Configure GPIO10 with the initialized pin configuration struct, to enable the input sampler on the pin. system_pinmux_pin_set_config(10, &config_pinmux); 9.1.2. Use Case 9.1.2.1. Code Copy-paste the following code to your user application: 9.1.2.2. Workflow system_pinmux_pin_set_input_sample_mode(10, SYSTEM_PINMUX_PIN_SAMPLE_ONDEMAND); while (true) { /* Infinite loop */ } 1. Adjust the configuration of the pin to enable on-demand sampling mode. system_pinmux_pin_set_input_sample_mode(10, SYSTEM_PINMUX_PIN_SAMPLE_ONDEMAND); 19

10. Document Revision History Doc. Rev. Date Comments 42121F 12/2015 Added support for SAM L21/L22, SAM DA1, SAM D09, and SAM C20/C21 42121E 12/2014 Added support for SAM R21 and SAM D10/D11 42121D 01/2014 Added support for SAM D21 42121C 09/2013 Fixed incorrect documentation for the device pin sampling mode 42121B 06/2013 Corrected documentation typos 42121A 06/2013 Initial release 20

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, Atmel logo and combinations thereof, Enabling Unlimited Possibilities, and others are registered trademarks or trademarks of Atmel Corporation in U.S. and other countries. ARM, ARM Connected logo, and others are registered trademarks of ARM Ltd. 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.