Contents
Preface
1. SAM Analog Comparator (AC) Driver
1.1. Prerequisites
1.2. Module Overview
1.2.1. Driver Feature Macro Definition
1.2.2. Window Comparators and Comparator Pairs
1.2.3. Positive and Negative Input MUXes
1.2.4. Output Filtering
1.2.5. Input Hysteresis
1.2.6. Single Shot and Continuous Sampling Modes
1.2.7. Events
1.2.8. Physical Connection
1.3. Special Considerations
1.4. Extra Information
1.5. Examples
1.6. API Overview
1.6.1. Macro Definitions
1.6.1.1. Type ac_callback_t
1.6.2. Function Definitions
1.6.2.1. Struct ac_chan_config
1.6.2.2. Struct ac_config
1.6.2.3. Struct ac_events
1.6.2.4. Struct ac_module
1.6.2.5. Struct ac_win_config
1.6.3. Peripheral Lock and Unlock
1.6.3.1. Driver Feature Definition
1.6.3.1.1. Macro FEATURE_AC_HYSTERESIS_LEVEL
1.6.3.1.2. Macro FEATURE_AC_SYNCBUSY_SCHEME_VERSION_2
1.6.3.1.3. Macro FEATURE_AC_RUN_IN_STANDY_EACH_COMPARATOR
1.6.3.2. AC Window Channel Status Flags
1.6.3.2.1. Macro AC_WIN_STATUS_UNKNOWN
1.6.3.2.2. Macro AC_WIN_STATUS_ABOVE
1.6.3.2.3. Macro AC_WIN_STATUS_INSIDE
1.6.3.2.4. Macro AC_WIN_STATUS_BELOW
1.6.3.2.5. Macro AC_WIN_STATUS_INTERRUPT_SET
1.6.3.3. AC Channel Status Flags
1.6.3.3.1. Macro AC_CHAN_STATUS_UNKNOWN
1.6.3.3.2. Macro AC_CHAN_STATUS_NEG_ABOVE_POS
1.6.3.3.3. Macro AC_CHAN_STATUS_POS_ABOVE_NEG
1.6.3.3.4. Macro AC_CHAN_STATUS_INTERRUPT_SET
1.6.4. APIs available for SAM L21/L22/C20/C21.
1.6.4.1. Driver Initialization and Configuration
1.6.4.1.1. Function ac_reset()
1.6.4.1.2. Function ac_init()
1.6.4.1.3. Function ac_is_syncing()
1.6.4.1.4. Function ac_get_config_defaults()
1.6.4.1.5. Function ac_enable()
1.6.4.1.6. Function ac_disable()
1.6.4.1.7. Function ac_enable_events()
1.6.4.1.8. Function ac_disable_events()
1.6.4.2. Enable/Disable
1.6.4.2.1. Function ac_chan_get_config_defaults()
1.6.4.2.2. Function ac_chan_set_config()
1.6.4.2.3. Function ac_chan_enable()
1.6.4.2.4. Function ac_chan_disable()
1.6.4.3. Lock/Unlock
1.6.4.3.1. Function ac_chan_trigger_single_shot()
1.6.4.3.2. Function ac_chan_is_ready()
1.6.4.3.3. Function ac_chan_get_status()
1.6.4.3.4. Function ac_chan_clear_status()
1.6.4.4. Ready to Write/Read
1.6.4.4.1. Function ac_win_get_config_defaults()
1.6.4.4.2. Function ac_win_set_config()
1.6.4.4.3. Function ac_win_enable()
1.6.4.4.4. Function ac_win_disable()
1.6.4.5. Read/Write
1.6.4.5.1. Function ac_win_is_ready()
1.6.4.5.2. Function ac_win_get_status()
1.6.4.5.3. Function ac_win_clear_status()
1.6.5. Callback Management
1.6.5.1. Enum ac_callback
1.6.5.2. Enum ac_chan_channel
1.6.5.3. Enum ac_chan_filter
1.6.5.4. Enum ac_chan_interrupt_selection
1.6.5.5. Enum ac_chan_neg_mux
1.6.5.6. Enum ac_chan_output
1.6.5.7. Enum ac_chan_pos_mux
1.6.5.8. Enum ac_chan_sample_mode
1.6.5.9. Enum ac_hysteresis_level
1.6.5.10. Enum ac_win_channel
1.6.5.11. Enum ac_win_interrupt_selection
1.7. Extra Information for AC Driver
1.7.1. Acronyms
1.7.2. Dependencies
1.7.3. Errata
1.7.4. Module History
1.8. Examples for AC Driver
1.8.1. Quick Start Guide for AC - Basic
1.8.1.1. Setup
1.8.1.1.1. Prerequisites
1.8.1.1.2. Code
1.8.1.1.3. Workflow
1.8.1.2. Implementation
1.8.1.2.1. Code
1.8.1.2.2. Workflow
1.8.2. Quick Start Guide for AC - Callback
1.8.2.1. Setup
1.8.2.1.1. Prerequisites
1.8.2.1.2. Code
1.8.2.1.3. Workflow
1.8.2.2. Implementation
1.8.2.2.1. Code
1.8.2.2.2. Workflow
2. SAM Analog-to-Digital Converter (ADC) Driver
2.1. Prerequisites
2.2. Module Overview
2.2.1. Sample Clock Prescaler
2.2.2. ADC Resolution
2.2.3. Conversion Modes
2.2.4. Differential and Single-ended Conversion
2.2.5. Sample Time
2.2.6. Averaging
2.2.7. Offset and Gain Correction
2.2.8. Pin Scan
2.2.9. Window Monitor
2.2.10. Events
2.3. Special Considerations
2.4. Extra Information
2.5. Examples
2.6. API Overview
2.6.1. Macro Definitions
2.6.1.1. Type adc_callback_t
2.6.2. Function Definitions
2.6.2.1. Struct adc_config
2.6.2.2. Struct adc_correction_config
2.6.2.3. Struct adc_events
2.6.2.4. Struct adc_module
2.6.2.5. Struct adc_window_config
2.6.3. Peripheral Lock and Unlock
2.6.3.1. Module Status Flags
2.6.3.1.1. Macro ADC_STATUS_RESULT_READY
2.6.3.1.2. Macro ADC_STATUS_WINDOW
2.6.3.1.3. Macro ADC_STATUS_OVERRUN
2.6.3.2. Macro FEATURE_ADC_SUPPORT_MASTER_SLAVE
2.6.4. APIs available for SAM L21/L22/C20/C21.
2.6.4.1. Driver Initialization and Configuration
2.6.4.1.1. Function adc_init()
2.6.4.1.2. Function adc_get_config_defaults()
2.6.4.2. Enable/Disable
2.6.4.2.1. Function adc_get_status()
2.6.4.2.2. Function adc_clear_status()
2.6.4.3. Lock/Unlock
2.6.4.3.1. Function adc_enable()
2.6.4.3.2. Function adc_disable()
2.6.4.3.3. Function adc_reset()
2.6.4.3.4. Function adc_enable_events()
2.6.4.3.5. Function adc_disable_events()
2.6.4.3.6. Function adc_start_conversion()
2.6.4.3.7. Function adc_read()
2.6.4.4. Ready to Write/Read
2.6.4.4.1. Function adc_flush()
2.6.4.4.2. Function adc_set_window_mode()
2.6.4.4.3. Function adc_set_positive_input()
2.6.4.4.4. Function adc_set_negative_input()
2.6.4.5. Read/Write
2.6.4.5.1. Function adc_enable_interrupt()
2.6.4.5.2. Function adc_disable_interrupt()
2.6.4.6. Callback Management
2.6.4.6.1. Function adc_register_callback()
2.6.4.6.2. Function adc_unregister_callback()
2.6.4.6.3. Function adc_enable_callback()
2.6.4.6.4. Function adc_disable_callback()
2.6.4.7. Writing and Reading
2.6.4.7.1. Function adc_read_buffer_job()
2.6.4.7.2. Function adc_get_job_status()
2.6.4.7.3. Function adc_abort_job()
2.6.4.8. Enumeration Definitions
2.6.4.8.1. Function adc_enable_positive_input_sequence()
2.6.4.8.2. Function adc_disable_positive_input_sequence()
2.6.4.8.3. Function adc_get_sequence_status()
2.6.4.9. Function adc_set_master_slave_mode()
2.6.5. System Debugger
2.6.5.1. Enum adc_accumulate_samples
2.6.5.2. Enum adc_callback
2.6.5.3. Enum adc_clock_prescaler
2.6.5.4. Enum adc_divide_result
2.6.5.5. Enum adc_dual_mode_trigger_selection
2.6.5.6. Enum adc_event_action
2.6.5.7. Enum adc_interrupt_flag
2.6.5.8. Enum adc_job_type
2.6.5.9. Enum adc_negative_input
2.6.5.10. Enum adc_oversampling_and_decimation
2.6.5.11. Enum adc_positive_input
2.6.5.12. Enum adc_reference
2.6.5.13. Enum adc_resolution
2.6.5.14. Enum adc_window_mode
2.7. Extra Information for ADC Driver
2.7.1. Acronyms
2.7.2. Dependencies
2.7.3. Errata
2.7.4. Module History
2.8. Examples for ADC Driver
2.8.1. Quick Start Guide for ADC - Basic
2.8.1.1. Setup
2.8.1.1.1. Prerequisites
2.8.1.1.2. Code
2.8.1.1.3. Workflow
2.8.1.2. Use Case
2.8.1.2.1. Code
2.8.1.2.2. Workflow
2.8.2. Quick Start Guide for ADC - Callback
2.8.2.1. Setup
2.8.2.1.1. Prerequisites
2.8.2.1.2. Code
2.8.2.1.3. Workflow
2.8.2.2. Use Case
2.8.2.2.1. Code
2.8.2.2.2. Workflow
2.8.3. Quick Start Guide for Using DMA with ADC/DAC
2.8.3.1. Setup
2.8.3.1.1. Prerequisites
2.8.3.1.2. Code
2.8.3.1.3. Workflow
2.8.3.1.3.1. Configure the ADC
2.8.3.1.3.2. Configure the DAC
2.8.3.1.3.3. Configure the DMA
2.8.3.2. Use Case
2.8.3.2.1. Code
2.8.3.2.2. Workflow
3. SAM Advanced Encryption Standard (AES) Driver
3.1. Prerequisites
3.2. Module Overview
3.2.1. Encryption and Decryption
3.2.2. Hardware Countermeasures
3.2.3. Galois Counter Mode (GCM)
3.3. Special Considerations
3.4. Extra Information
3.5. Examples
3.6. API Overview
3.6.1. Macro Definitions
3.6.1.1. Type aes_callback_t
3.6.2. Function Definitions
3.6.2.1. Struct aes_config
3.6.3. Peripheral Lock and Unlock
3.6.3.1. Module Status Flags
3.6.3.1.1. Macro AES_ENCRYPTION_COMPLETE
3.6.3.1.2. Macro AES_GF_MULTI_COMPLETE
3.6.4. APIs available for SAM L21/L22/C20/C21.
3.6.4.1. Driver Initialization and Configuration
3.6.4.1.1. Function aes_get_config_defaults()
3.6.4.1.2. Function aes_set_config()
3.6.4.1.3. Function aes_init()
3.6.4.2. Enable/Disable
3.6.4.2.1. Function aes_start()
3.6.4.2.2. Function aes_set_new_message()
3.6.4.2.3. Function aes_clear_new_message()
3.6.4.2.4. Function aes_enable()
3.6.4.2.5. Function aes_disable()
3.6.4.2.6. Function aes_write_key()
3.6.4.2.7. Function aes_write_init_vector()
3.6.4.2.8. Function aes_write_input_data()
3.6.4.2.9. Function aes_read_output_data()
3.6.4.2.10. Function aes_write_random_seed()
3.6.4.3. Lock/Unlock
3.6.4.3.1. Function aes_get_status()
3.6.4.3.2. Function aes_clear_status()
3.6.4.4. Ready to Write/Read
3.6.4.4.1. Function aes_gcm_read_ghash()
3.6.4.4.2. Function aes_gcm_write_ghash()
3.6.4.4.3. Function aes_gcm_read_hash_key()
3.6.4.4.4. Function aes_gcm_write_hash_key()
3.6.4.4.5. Function aes_gcm_read_cipher_len()
3.6.4.4.6. Function aes_gcm_write_cipher_len()
3.6.4.4.7. Function aes_gcm_set_end_message_status()
3.6.4.4.8. Function aes_gcm_clear_end_message_status()
3.6.4.4.9. Function aes_gcm_set_gf_multiplication()
3.6.4.5. Read/Write
3.6.4.5.1. Function aes_register_callback()
3.6.4.5.2. Function aes_unregister_callback()
3.6.4.6. Callback Management
3.6.4.6.1. Function aes_enable_callback()
3.6.4.6.2. Function aes_disable_callback()
3.6.5. Writing and Reading
3.6.5.1. Enum aes_callback_type
3.6.5.2. Enum aes_cfb_size
3.6.5.3. Enum aes_countermeature_type
3.6.5.4. Enum aes_encrypt_mode
3.6.5.5. Enum aes_key_size
3.6.5.6. Enum aes_operation_mode
3.6.5.7. Enum aes_start_mode
3.7. Extra Information for Advanced Encryption Standard
3.7.1. Acronyms
3.7.2. Dependencies
3.7.3. Errata
3.7.4. Module History
3.8. Examples for Advanced Encryption Standard
3.8.1. Quick Start Guide for AES - Basic
3.8.1.1. Quick Start
3.8.1.1.1. Prerequisites
3.8.1.1.2. Code
3.8.1.1.3. Workflow
3.8.1.2. Use Case
3.8.1.2.1. Code
3.8.1.2.2. Workflow
3.8.2. Quick Start Guide for AES - Callback
3.8.2.1. Quick Start Callback
3.8.2.1.1. Prerequisites
3.8.2.1.2. Code
3.8.2.1.3. Workflow
3.8.2.2. Use Case
3.8.2.2.1. Code
3.8.2.2.2. Workflow
3.8.3. Quick Start Guide for AES - DMA
3.8.3.1. Quick Start
3.8.3.1.1. Prerequisites
3.8.3.1.2. Code
3.8.3.1.3. Workflow
3.8.3.2. Use Case
3.8.3.2.1. Code
3.8.3.2.2. Workflow
4. SAM Brown Out Detector (BOD) Driver
4.1. Prerequisites
4.2. Module Overview
4.3. Special Considerations
4.4. Extra Information
4.5. Examples
4.6. API Overview
4.6.1. Macro Definitions
4.6.1.1. Struct bod12_config
4.6.1.2. Struct bod33_config
4.6.2. Function Definitions
4.6.2.1. Peripheral Lock and Unlock
4.6.2.1.1. Function bod33_get_config_defaults()
4.6.2.1.2. Function bod33_set_config()
4.6.2.1.3. Function bod33_enable()
4.6.2.1.4. Function bod33_disable()
4.6.2.1.5. Function bod33_is_detected()
4.6.2.1.6. Function bod33_clear_detected()
4.6.2.1.7. Function bod12_get_config_defaults()
4.6.2.1.8. Function bod12_set_config()
4.6.2.1.9. Function bod12_enable()
4.6.2.1.10. Function bod12_disable()
4.6.2.1.11. Function bod12_is_detected()
4.6.2.1.12. Function bod12_clear_detected()
4.6.3. APIs available for SAM L21/L22/C20/C21.
4.6.3.1. Enum bod12_action
4.6.3.2. Enum bod12_mode_in_active
4.6.3.3. Enum bod12_mode_in_standby
4.6.3.4. Enum bod12_prescale
4.6.3.5. Enum bod33_action
4.6.3.6. Enum bod33_mode_in_active
4.6.3.7. Enum bod33_mode_in_standby
4.6.3.8. Enum bod33_prescale
4.6.3.9. Enum bod33_vol_monitor
4.7. Extra Information for BOD Driver
4.7.1. Acronyms
4.7.2. Dependencies
4.7.3. Errata
4.7.4. Module History
4.8. Examples for BOD Driver
4.8.1. Quick Start Guide for BOD - Basic
4.8.1.1. Quick Start
4.8.1.1.1. Prerequisites
4.8.1.1.2. Code
4.8.1.1.3. Workflow
4.8.1.2. Use Case
4.8.1.2.1. Code
4.8.1.2.2. Workflow
4.8.2. Application Use Case for BOD - Application
5. SAM Configurable Custom Logic (CCL) Driver
5.1. Prerequisites
5.2. Module Overview
5.3. Special Considerations
5.4. Extra Information
5.5. Examples
5.6. API Overview
5.6.1. Macro Definitions
5.6.1.1. Struct ccl_config
5.6.1.2. Struct ccl_lut_config
5.6.2. Function Definitions
5.6.2.1. Peripheral Lock and Unlock
5.6.2.1.1. Function ccl_init()
5.6.2.1.2. Function ccl_get_config_defaults()
5.6.2.1.3. Function ccl_module_reset()
5.6.2.2. APIs available for SAM L21/L22/C20/C21.
5.6.2.2.1. Function ccl_module_enable()
5.6.2.2.2. Function ccl_module_disable()
5.6.2.3. Driver Initialization and Configuration
5.6.2.3.1. Function ccl_seq_config()
5.6.2.3.2. Function ccl_lut_get_config_defaults()
5.6.2.3.3. Function ccl_lut_set_config()
5.6.2.4. Enable/Disable
5.6.2.4.1. Function ccl_lut_enable()
5.6.2.4.2. Function ccl_lut_disable()
5.6.3. Lock/Unlock
5.6.3.1. Enum ccl_lut_filter_sel
5.6.3.2. Enum ccl_lut_id
5.6.3.3. Enum ccl_lut_input_src_sel
5.6.3.4. Enum ccl_seq_id
5.6.3.5. Enum ccl_seq_selection
5.7. Extra Information for CCL Driver
5.7.1. Acronyms
5.7.2. Dependencies
5.7.3. Errata
5.7.4. Module History
5.8. Examples for CCL Driver
5.8.1. Quick Start Guide for CCL - Basic
5.8.1.1. Setup
5.8.1.1.1. Prerequisites
5.8.1.1.2. Code
5.8.1.1.3. Workflow
5.8.1.2. Use Case
5.8.1.2.1. Code
6. SAM Digital-to-Analog (DAC) Driver
6.1. Prerequisites
6.2. Module Overview
6.2.1. Conversion Range
6.2.2. Conversion
6.2.3. Analog Output
6.2.4. Events
6.2.5. Left and Right Adjusted Values
6.2.6. Clock Sources
6.3. Special Considerations
6.3.1. Sleep Mode
6.3.2. Conversion Time
6.4. Extra Information
6.5. Examples
6.6. API Overview
6.6.1. Macro Definitions
6.6.1.1. Type dac_callback_t
6.6.2. Function Definitions
6.6.2.1. Struct dac_chan_config
6.6.2.2. Struct dac_config
6.6.2.3. Struct dac_events
6.6.2.4. Struct dac_module
6.6.3. Peripheral Lock and Unlock
6.6.3.1. DAC Status Flags
6.6.3.1.1. Macro DAC_STATUS_CHANNEL_0_EMPTY
6.6.3.1.2. Macro DAC_STATUS_CHANNEL_1_EMPTY
6.6.3.1.3. Macro DAC_STATUS_CHANNEL_0_UNDERRUN
6.6.3.1.4. Macro DAC_STATUS_CHANNEL_1_UNDERRUN
6.6.3.2. Macro DAC_TIMEOUT
6.6.4. APIs available for SAM L21/L22/C20/C21.
6.6.4.1. Driver Initialization and Configuration
6.6.4.1.1. Function dac_is_syncing()
6.6.4.1.2. Function dac_get_config_defaults()
6.6.4.1.3. Function dac_init()
6.6.4.1.4. Function dac_reset()
6.6.4.1.5. Function dac_enable()
6.6.4.1.6. Function dac_disable()
6.6.4.1.7. Function dac_enable_events()
6.6.4.1.8. Function dac_disable_events()
6.6.4.2. Enable/Disable
6.6.4.2.1. Function dac_chan_get_config_defaults()
6.6.4.2.2. Function dac_chan_set_config()
6.6.4.2.3. Function dac_chan_enable()
6.6.4.2.4. Function dac_chan_disable()
6.6.4.3. Lock/Unlock
6.6.4.3.1. Function dac_chan_write()
6.6.4.3.2. Function dac_chan_write_buffer_wait()
6.6.4.4. Ready to Write/Read
6.6.4.4.1. Function dac_get_status()
6.6.4.4.2. Function dac_clear_status()
6.6.4.5. Read/Write
6.6.4.5.1. Function dac_chan_write_buffer_job()
6.6.4.5.2. Function dac_chan_write_job()
6.6.4.5.3. Function dac_register_callback()
6.6.4.5.4. Function dac_unregister_callback()
6.6.4.6. Callback Management
6.6.4.6.1. Function dac_chan_enable_callback()
6.6.4.6.2. Function dac_chan_disable_callback()
6.6.4.6.3. Function dac_chan_get_job_status()
6.6.4.6.4. Function dac_chan_abort_job()
6.6.4.7. Writing and Reading
6.6.4.7.1. Function dac_chan_is_end_of_conversion()
6.6.5. Enumeration Definitions
6.6.5.1. Enum dac_callback
6.6.5.2. Enum dac_channel
6.6.5.3. Enum dac_current_ctrl
6.6.5.4. Enum dac_reference
6.7. Extra Information for DAC Driver
6.7.1. Acronyms
6.7.2. Dependencies
6.7.3. Errata
6.7.4. Module History
6.8. Examples for DAC Driver
6.8.1. Quick Start Guide for DAC - Basic
6.8.1.1. Quick Start
6.8.1.1.1. Prerequisites
6.8.1.1.2. Code
6.8.1.1.3. Workflow
6.8.1.2. Use Case
6.8.1.2.1. Code
6.8.1.2.2. Workflow
6.8.2. Quick Start Guide for DAC - Callback
6.8.2.1. Setup
6.8.2.1.1. Prerequisites
6.8.2.1.2. Code
6.8.2.1.3. Workflow
6.8.2.2. Use Case
6.8.2.2.1. Code
6.8.2.2.2. Workflow
7. SAM Direct Memory Access Controller Driver (DMAC)
7.1. Prerequisites
7.2. Module Overview
7.2.1. Driver Feature Macro Definition
7.2.2. Terminology Used in DMAC Transfers
7.2.3. DMA Channels
7.2.4. DMA Triggers
7.2.5. DMA Transfer Descriptor
7.2.6. DMA Interrupts/Events
7.3. Special Considerations
7.4. Extra Information
7.5. Examples
7.6. API Overview
7.6.1. Macro Definitions
7.6.1.1. Type dma_callback_t
7.6.1.2. Variable descriptor_section
7.6.1.3. Variable g_chan_interrupt_flag
7.6.2. Function Definitions
7.6.2.1. Struct dma_descriptor_config
7.6.2.2. Struct dma_events_config
7.6.2.3. Struct dma_resource
7.6.2.4. Struct dma_resource_config
7.6.3. Peripheral Lock and Unlock
7.6.3.1. Macro DMA_INVALID_CHANNEL
7.6.3.2. Macro FEATURE_DMA_CHANNEL_STANDBY
7.6.4. APIs available for SAM L21/L22/C20/C21.
7.6.4.1. Function dma_abort_job()
7.6.4.2. Function dma_add_descriptor()
7.6.4.3. Function dma_allocate()
7.6.4.4. Function dma_descriptor_create()
7.6.4.5. Function dma_descriptor_get_config_defaults()
7.6.4.6. Function dma_disable_callback()
7.6.4.7. Function dma_enable_callback()
7.6.4.8. Function dma_free()
7.6.4.9. Function dma_get_config_defaults()
7.6.4.10. Function dma_get_job_status()
7.6.4.11. Function dma_is_busy()
7.6.4.12. Function dma_register_callback()
7.6.4.13. Function dma_reset_descriptor()
7.6.4.14. Function dma_resume_job()
7.6.4.15. Function dma_start_transfer_job()
7.6.4.16. Function dma_suspend_job()
7.6.4.17. Function dma_trigger_transfer()
7.6.4.18. Function dma_unregister_callback()
7.6.4.19. Function dma_update_descriptor()
7.6.5. Driver Initialization and Configuration
7.6.5.1. Enum dma_address_increment_stepsize
7.6.5.2. Enum dma_beat_size
7.6.5.3. Enum dma_block_action
7.6.5.4. Enum dma_callback_type
7.6.5.5. Enum dma_event_input_action
7.6.5.6. Enum dma_event_output_selection
7.6.5.7. Enum dma_priority_level
7.6.5.8. Enum dma_step_selection
7.6.5.9. Enum dma_transfer_trigger_action
7.7. Extra Information for DMAC Driver
7.7.1. Acronyms
7.7.2. Dependencies
7.7.3. Errata
7.7.4. Module History
7.8. Examples for DMAC Driver
7.8.1. Quick Start Guide for Memory to Memory Data Transfer Using DMAC
7.8.1.1. Setup
7.8.1.1.1. Prerequisites
7.8.1.1.2. Code
7.8.1.1.3. Workflow
7.8.1.2. Use Case
7.8.1.2.1. Code
7.8.1.2.2. Workflow
8. SAM Event System (EVENTS) Driver
8.1. Prerequisites
8.2. Module Overview
8.2.1. Event Channels
8.2.2. Event Users
8.2.3. Edge Detection
8.2.4. Path Selection
8.2.4.1. Asynchronous Paths
8.2.4.2. Synchronous Paths
8.2.4.3. Re-synchronous Paths
8.2.5. Physical Connection
8.2.6. Configuring Events
8.2.6.1. Source Peripheral
8.2.6.2. Event System
8.2.6.3. Destination Peripheral
8.3. Special Considerations
8.4. Extra Information
8.5. Examples
8.6. API Overview
8.6.1. Macro Definitions
8.6.1.1. Type events_interrupt_hook
8.6.2. Function Definitions
8.6.2.1. Struct events_config
8.6.2.2. Struct events_hook
8.6.2.3. Struct events_resource
8.6.3. Peripheral Lock and Unlock
8.6.3.1. Macro EVSYS_ID_GEN_NONE
8.6.4. APIs available for SAM L21/L22/C20/C21.
8.6.4.1. Function events_ack_interrupt()
8.6.4.2. Function events_add_hook()
8.6.4.3. Function events_allocate()
8.6.4.4. Function events_attach_user()
8.6.4.5. Function events_create_hook()
8.6.4.6. Function events_del_hook()
8.6.4.7. Function events_detach_user()
8.6.4.8. Function events_disable_interrupt_source()
8.6.4.9. Function events_enable_interrupt_source()
8.6.4.10. Function events_get_config_defaults()
8.6.4.11. Function events_get_free_channels()
8.6.4.12. Function events_is_busy()
8.6.4.13. Function events_is_detected()
8.6.4.14. Function events_is_interrupt_set()
8.6.4.15. Function events_is_overrun()
8.6.4.16. Function events_is_users_ready()
8.6.4.17. Function events_release()
8.6.4.18. Function events_trigger()
8.6.5. Driver Initialization and Configuration
8.6.5.1. Enum events_edge_detect
8.6.5.2. Enum events_interrupt_source
8.6.5.3. Enum events_path_selection
8.7. Extra Information for EVENTS Driver
8.7.1. Acronyms
8.7.2. Dependencies
8.7.3. Errata
8.7.4. Module History
8.8. Examples for EVENTS Driver
8.8.1. Quick Start Guide for EVENTS - Basic
8.8.1.1. Setup
8.8.1.1.1. Prerequisites
8.8.1.1.2. Code
8.8.1.1.3. Workflow
8.8.1.2. Use Case
8.8.1.2.1. Code
8.8.1.2.2. Workflow
8.8.2. Quick Start Guide for EVENTS - Interrupt Hooks
8.8.2.1. Setup
8.8.2.1.1. Prerequisites
8.8.2.1.2. Code
8.8.2.1.3. Workflow
8.8.2.2. Use Case
8.8.2.2.1. Code
8.8.2.2.2. Workflow
9. SAM External Interrupt (EXTINT) Driver
9.1. Prerequisites
9.2. Module Overview
9.2.1. Logical Channels
9.2.2. NMI Channels
9.2.3. Input Filtering and Detection
9.2.4. Events and Interrupts
9.2.5. Physical Connection
9.3. Special Considerations
9.4. Extra Information
9.5. Examples
9.6. API Overview
9.6.1. Macro Definitions
9.6.1.1. Type extint_callback_t
9.6.2. Function Definitions
9.6.2.1. Struct extint_chan_conf
9.6.2.2. Struct extint_events
9.6.2.3. Struct extint_nmi_conf
9.6.3. Peripheral Lock and Unlock
9.6.3.1. Macro EIC_NUMBER_OF_INTERRUPTS
9.6.3.2. Macro EXTINT_CLK_GCLK
9.6.3.3. Macro EXTINT_CLK_ULP32K
9.6.4. APIs available for SAM L21/L22/C20/C21.
9.6.4.1. Driver Initialization and Configuration
9.6.4.1.1. Function extint_enable_events()
9.6.4.1.2. Function extint_disable_events()
9.6.4.2. Enable/Disable
9.6.4.2.1. Function extint_chan_get_config_defaults()
9.6.4.2.2. Function extint_chan_set_config()
9.6.4.3. Lock/Unlock
9.6.4.3.1. Function extint_nmi_get_config_defaults()
9.6.4.3.2. Function extint_nmi_set_config()
9.6.4.4. Ready to Write/Read
9.6.4.4.1. Function extint_chan_is_detected()
9.6.4.4.2. Function extint_chan_clear_detected()
9.6.4.5. Read/Write
9.6.4.5.1. Function extint_nmi_is_detected()
9.6.4.5.2. Function extint_nmi_clear_detected()
9.6.4.6. Callback Management
9.6.4.6.1. Function extint_register_callback()
9.6.4.6.2. Function extint_unregister_callback()
9.6.4.6.3. Function extint_get_current_channel()
9.6.4.7. Writing and Reading
9.6.4.7.1. Function extint_chan_enable_callback()
9.6.4.7.2. Function extint_chan_disable_callback()
9.6.5. Enumeration Definitions
9.6.5.1. System Debugger
9.6.5.1.1. Enum extint_callback_type
9.6.5.2. Enum extint_detect
9.6.5.3. Enum extint_pull
9.7. Extra Information for EXTINT Driver
9.7.1. Acronyms
9.7.2. Dependencies
9.7.3. Errata
9.7.4. Module History
9.8. Examples for EXTINT Driver
9.8.1. Quick Start Guide for EXTINT - Basic
9.8.1.1. Setup
9.8.1.1.1. Prerequisites
9.8.1.1.2. Code
9.8.1.1.3. Workflow
9.8.1.2. Use Case
9.8.1.2.1. Code
9.8.1.2.2. Workflow
9.8.2. Quick Start Guide for EXTINT - Callback
9.8.2.1. Setup
9.8.2.1.1. Prerequisites
9.8.2.1.2. Code
9.8.2.1.3. Workflow
9.8.2.2. Use Case
9.8.2.2.1. Code
9.8.2.2.2. Workflow
10. SAM Non-Volatile Memory (NVM) Driver
10.1. Prerequisites
10.2. Module Overview
10.2.1. Driver Feature Macro Definition
10.2.2. Memory Regions
10.2.3. Region Lock Bits
10.2.4. Read/Write
10.3. Special Considerations
10.3.1. Page Erasure
10.3.2. Clocks
10.3.3. Security Bit
10.4. Extra Information
10.5. Examples
10.6. API Overview
10.6.1. Macro Definitions
10.6.1.1. Struct nvm_config
10.6.1.2. Struct nvm_fusebits
10.6.1.3. Struct nvm_parameters
10.6.2. Function Definitions
10.6.2.1. Macro FEATURE_NVM_RWWEE
10.6.2.2. Macro FEATURE_BOD12
10.6.3. Peripheral Lock and Unlock
10.6.3.1. APIs available for SAM L21/L22/C20/C21.
10.6.3.1.1. Function nvm_get_config_defaults()
10.6.3.1.2. Function nvm_set_config()
10.6.3.1.3. Function nvm_is_ready()
10.6.3.2. Driver Initialization and Configuration
10.6.3.2.1. Function nvm_get_parameters()
10.6.3.2.2. Function nvm_write_buffer()
10.6.3.2.3. Function nvm_read_buffer()
10.6.3.2.4. Function nvm_update_buffer()
10.6.3.2.5. Function nvm_erase_row()
10.6.3.2.6. Function nvm_execute_command()
10.6.3.2.7. Function nvm_get_fuses()
10.6.3.2.8. Function nvm_set_fuses()
10.6.3.2.9. Function nvm_is_page_locked()
10.6.3.2.10. Function nvm_get_error()
10.6.4. Enable/Disable
10.6.4.1. Enum nvm_bod12_action
10.6.4.2. Enum nvm_bod33_action
10.6.4.3. Enum nvm_bootloader_size
10.6.4.4. Enum nvm_cache_readmode
10.6.4.5. Enum nvm_command
10.6.4.6. Enum nvm_eeprom_emulator_size
10.6.4.7. Enum nvm_error
10.6.4.8. Enum nvm_sleep_power_mode
10.6.4.9. Enum nvm_wdt_early_warning_offset
10.6.4.10. Enum nvm_wdt_window_timeout
10.7. Extra Information for NVM Driver
10.7.1. Acronyms
10.7.2. Dependencies
10.7.3. Errata
10.7.4. Module History
10.8. Examples for NVM Driver
10.8.1. Quick Start Guide for NVM - Basic
10.8.1.1. Setup
10.8.1.1.1. Prerequisites
10.8.1.1.2. Code
10.8.1.1.3. Workflow
10.8.1.2. Use Case
10.8.1.2.1. Code
10.8.1.2.2. Workflow
11. SAM Operational Amplifier Controller (OPAMP) Driver
11.1. Prerequisites
11.2. Module Overview
11.3. Special Considerations
11.4. Extra Information
11.5. Examples
11.6. API Overview
11.6.1. Macro Definitions
11.6.1.1. Struct opamp0_config
11.6.1.2. Struct opamp1_config
11.6.1.3. Struct opamp2_config
11.6.1.4. Struct opamp_config_common
11.6.2. Function Definitions
11.6.2.1. Function opamp0_get_config_defaults()
11.6.2.2. Function opamp0_set_config()
11.6.2.3. Function opamp1_get_config_defaults()
11.6.2.4. Function opamp1_set_config()
11.6.2.5. Function opamp2_get_config_defaults()
11.6.2.6. Function opamp2_set_config()
11.6.2.7. Function opamp_disable()
11.6.2.8. Function opamp_enable()
11.6.2.9. Function opamp_is_ready()
11.6.2.10. Function opamp_module_disable()
11.6.2.11. Function opamp_module_enable()
11.6.2.12. Function opamp_module_init()
11.6.2.13. Function opamp_module_reset()
11.6.2.14. Function opamp_voltage_doubler_disable()
11.6.2.15. Function opamp_voltage_doubler_enable()
11.6.3. Peripheral Lock and Unlock
11.6.3.1. Enum opamp0_neg_mux
11.6.3.2. Enum opamp0_pos_mux
11.6.3.3. Enum opamp0_res1_mux
11.6.3.4. Enum opamp1_neg_mux
11.6.3.5. Enum opamp1_pos_mux
11.6.3.6. Enum opamp1_res1_mux
11.6.3.7. Enum opamp2_neg_mux
11.6.3.8. Enum opamp2_pos_mux
11.6.3.9. Enum opamp2_res1_mux
11.6.3.10. Enum opamp_bias_selection
11.6.3.11. Enum opamp_id
11.6.3.12. Enum opamp_pot_mux
11.7. Extra Information for OPAMP Driver
11.7.1. Acronyms
11.7.2. Dependencies
11.7.3. Errata
11.7.4. Module History
11.8. Examples for OPAMP Driver
11.8.1. Quick Start Guide for OPAMP - Basic
11.8.1.1. Setup
11.8.1.1.1. Prerequisites
11.8.1.1.2. Code
11.8.1.1.3. Workflow
11.8.1.2. Use Case
11.8.1.2.1. Code
12. SAM Peripheral Access Controller (PAC) Driver
12.1. Prerequisites
12.2. Module Overview
12.2.1. Locking Scheme
12.2.2. Recommended Implementation
12.2.3. Why Disable Interrupts
12.2.4. Run-away Code
12.2.4.1. Key-Argument
12.2.5. Faulty Module Pointer
12.2.6. Use of __no_inline
12.2.7. Physical Connection
12.3. Special Considerations
12.3.1. Non-Writable Registers
12.3.2. Reading Lock State
12.4. Extra Information
12.5. Examples
12.6. API Overview
12.6.1. Macro Definitions
12.6.1.1. Macro SYSTEM_PERIPHERAL_ID
12.6.2. Function Definitions
12.6.2.1. Peripheral Lock and Unlock
12.6.2.1.1. Function system_peripheral_lock()
12.6.2.1.2. Function system_peripheral_unlock()
12.6.2.2. APIs available for SAM L21/L22/C20/C21.
12.6.2.2.1. Function system_peripheral_lock_always()
12.6.2.2.2. Function system_pac_enable_interrupt()
12.6.2.2.3. Function system_pac_disable_interrupt()
12.6.2.2.4. Function system_pac_enable_event()
12.6.2.2.5. Function system_pac_disable_event()
12.7. Extra Information for PAC Driver
12.7.1. Acronyms
12.7.2. Dependencies
12.7.3. Errata
12.7.4. Module History
12.8. Examples for PAC Driver
12.8.1. Quick Start Guide for PAC - Basic
12.8.1.1. Setup
12.8.1.1.1. Prerequisites
12.8.1.1.2. Code
12.8.1.2. Use Case
12.8.1.2.1. Code
12.8.1.2.2. Workflow
12.9. List of Non-Write Protected Registers
13. SAM Port (PORT) Driver
13.1. Prerequisites
13.2. Module Overview
13.2.1. Driver Feature Macro Definition
13.2.2. Physical and Logical GPIO Pins
13.2.3. Physical Connection
13.3. Special Considerations
13.4. Extra Information
13.5. Examples
13.6. API Overview
13.6.1. Macro Definitions
13.6.1.1. Struct port_config
13.6.1.2. Struct port_input_event_config
13.6.2. Function Definitions
13.6.2.1. Driver Feature Definition
13.6.2.1.1. Macro FEATURE_PORT_INPUT_EVENT
13.6.2.2. Peripheral Lock and Unlock
13.6.2.2.1. Macro PORTA
13.6.2.2.2. Macro PORTB
13.6.2.2.3. Macro PORTC
13.6.2.2.4. Macro PORTD
13.6.3. APIs available for SAM L21/L22/C20/C21.
13.6.3.1. Driver Initialization and Configuration
13.6.3.1.1. Function port_get_group_from_gpio_pin()
13.6.3.1.2. Function port_group_get_input_level()
13.6.3.1.3. Function port_group_get_output_level()
13.6.3.1.4. Function port_group_set_output_level()
13.6.3.1.5. Function port_group_toggle_output_level()
13.6.3.2. Enable/Disable
13.6.3.2.1. Function port_get_config_defaults()
13.6.3.2.2. Function port_pin_set_config()
13.6.3.2.3. Function port_group_set_config()
13.6.3.3. Lock/Unlock
13.6.3.3.1. Function port_pin_get_input_level()
13.6.3.3.2. Function port_pin_get_output_level()
13.6.3.3.3. Function port_pin_set_output_level()
13.6.3.3.4. Function port_pin_toggle_output_level()
13.6.3.4. Ready to Write/Read
13.6.3.4.1. Function port_enable_input_event()
13.6.3.4.2. Function port_disable_input_event()
13.6.3.4.3. Function port_input_event_get_config_defaults()
13.6.3.4.4. Function port_input_event_set_config()
13.6.4. Read/Write
13.6.4.1. Enum port_input_event
13.6.4.2. Enum port_input_event_action
13.6.4.3. Enum port_pin_dir
13.6.4.4. Enum port_pin_pull
13.7. Extra Information for PORT Driver
13.7.1. Acronyms
13.7.2. Dependencies
13.7.3. Errata
13.7.4. Module History
13.8. Examples for PORT Driver
13.8.1. Quick Start Guide for PORT - Basic
13.8.1.1. Setup
13.8.1.1.1. Prerequisites
13.8.1.1.2. Code
13.8.1.1.3. Workflow
13.8.1.2. Use Case
13.8.1.2.1. Code
13.8.1.2.2. Workflow
14. SAM RTC Count (RTC COUNT) Driver
14.1. Prerequisites
14.2. Module Overview
14.2.1. Driver Feature Macro Definition
14.3. Compare and Overflow
14.3.1. Periodic Events
14.3.2. Digital Frequency Correction
14.3.3. RTC Tamper Detect
14.4. Special Considerations
14.4.1. Clock Setup
14.4.1.1. SAM D20/D21/R21/D10/D11/DA1 Clock Setup
14.4.1.2. SAM L21/C20/C21 Clock Setup
14.5. Extra Information
14.6. Examples
14.7. API Overview
14.7.1. Macro Definitions
14.7.1.1. Struct rtc_count_config
14.7.1.2. Struct rtc_count_events
14.7.1.3. Struct rtc_tamper_config
14.7.1.4. Struct rtc_tamper_input_config
14.7.2. Function Definitions
14.7.2.1. Macro FEATURE_RTC_PERIODIC_INT
14.7.2.2. Macro FEATURE_RTC_PRESCALER_OFF
14.7.2.3. Macro FEATURE_RTC_CLOCK_SELECTION
14.7.2.4. Macro FEATURE_RTC_GENERAL_PURPOSE_REG
14.7.2.5. Macro FEATURE_RTC_TAMPER_DETECTION
14.7.2.6. Macro RTC_TAMPER_DETECT_EVT
14.7.2.7. Macro RTC_TAMPER_DETECT_ID0
14.7.2.8. Macro RTC_TAMPER_DETECT_ID1
14.7.2.9. Macro RTC_TAMPER_DETECT_ID2
14.7.2.10. Macro RTC_TAMPER_DETECT_ID3
14.7.2.11. Macro RTC_TAMPER_DETECT_ID4
14.7.3. Peripheral Lock and Unlock
14.7.3.1. APIs available for SAM L21/L22/C20/C21.
14.7.3.1.1. Function rtc_count_get_config_defaults()
14.7.3.1.2. Function rtc_count_reset()
14.7.3.1.3. Function rtc_count_enable()
14.7.3.1.4. Function rtc_count_disable()
14.7.3.1.5. Function rtc_count_init()
14.7.3.1.6. Function rtc_count_frequency_correction()
14.7.3.2. Driver Initialization and Configuration
14.7.3.2.1. Function rtc_count_set_count()
14.7.3.2.2. Function rtc_count_get_count()
14.7.3.2.3. Function rtc_count_set_compare()
14.7.3.2.4. Function rtc_count_get_compare()
14.7.3.2.5. Function rtc_count_set_period()
14.7.3.2.6. Function rtc_count_get_period()
14.7.3.3. Enable/Disable
14.7.3.3.1. Function rtc_count_is_overflow()
14.7.3.3.2. Function rtc_count_clear_overflow()
14.7.3.3.3. Function rtc_count_is_periodic_interval()
14.7.3.3.4. Function rtc_count_clear_periodic_interval()
14.7.3.3.5. Function rtc_count_is_compare_match()
14.7.3.3.6. Function rtc_count_clear_compare_match()
14.7.3.4. Lock/Unlock
14.7.3.4.1. Function rtc_count_enable_events()
14.7.3.4.2. Function rtc_count_disable_events()
14.7.3.5. Ready to Write/Read
14.7.3.5.1. Function rtc_write_general_purpose_reg()
14.7.3.5.2. Function rtc_read_general_purpose_reg()
14.7.3.6. Read/Write
14.7.3.6.1. Function rtc_count_register_callback()
14.7.3.6.2. Function rtc_count_unregister_callback()
14.7.3.6.3. Function rtc_count_enable_callback()
14.7.3.6.4. Function rtc_count_disable_callback()
14.7.3.7. Callback Management
14.7.3.7.1. Function rtc_tamper_get_config_defaults()
14.7.3.7.2. Function rtc_tamper_set_config()
14.7.3.7.3. Function rtc_tamper_get_detect_flag()
14.7.3.7.4. Function rtc_tamper_clear_detect_flag()
14.7.3.8. Function rtc_tamper_get_stamp()
14.7.4. Writing and Reading
14.7.4.1. Enum rtc_clock_sel
14.7.4.2. Enum rtc_count_callback
14.7.4.3. Enum rtc_count_compare
14.7.4.4. Enum rtc_count_mode
14.7.4.5. Enum rtc_count_periodic_interval
14.7.4.6. Enum rtc_count_prescaler
14.7.4.7. Enum rtc_tamper_active_layer_freq_divider
14.7.4.8. Enum rtc_tamper_debounce_freq_divider
14.7.4.9. Enum rtc_tamper_debounce_seq
14.7.4.10. Enum rtc_tamper_input_action
14.7.4.11. Enum rtc_tamper_level_sel
14.8. RTC Tamper Detect
14.9. Extra Information for RTC COUNT Driver
14.9.1. Acronyms
14.9.2. Dependencies
14.9.3. Errata
14.9.4. Module History
14.10. Examples for RTC (COUNT) Driver
14.10.1. Quick Start Guide for RTC (COUNT) - Basic
14.10.1.1. Prerequisites
14.10.1.1.1. Clocks and Oscillators
14.10.1.2. Setup
14.10.1.2.1. Initialization Code
14.10.1.2.2. Add to Main
14.10.1.2.3. Workflow
14.10.1.3. Implementation
14.10.1.3.1. Code
14.10.1.3.2. Workflow
14.10.2. Quick Start Guide for RTC (COUNT) - Callback
14.10.2.1. Prerequisites
14.10.2.1.1. Clocks and Oscillators
14.10.2.2. Setup
14.10.2.2.1. Code
14.10.2.2.2. Workflow
14.10.2.3. Implementation
14.10.2.3.1. Code
14.10.2.3.2. Workflow
14.10.2.4. Callback
14.10.2.4.1. Workflow
14.10.3. Quick Start Guide for RTC Tamper with DMA
14.10.3.1. Setup
14.10.3.1.1. Prerequisites
14.10.3.1.2. Code
14.10.3.1.3. Workflow
14.10.3.2. Implementation
14.10.3.2.1. Code
14.10.3.2.2. Callback
15. SAM RTC Calendar (RTC CAL) Driver
15.1. Prerequisites
15.2. Module Overview
15.2.1. Driver Feature Macro Definition
15.2.2. Alarms and Overflow
15.2.3. Periodic Events
15.2.4. Digital Frequency Correction
15.2.5. RTC Tamper Detect
15.3. Special Considerations
15.3.1. Year Limit
15.3.2. Clock Setup
15.3.2.1. SAM D20/D21/R21/D10/D11/DA1 Clock Setup
15.3.2.2. SAM L21/C20/C21 Clock Setup
15.4. Extra Information
15.5. Examples
15.6. API Overview
15.6.1. Macro Definitions
15.6.1.1. Struct rtc_calendar_alarm_time
15.6.1.2. Struct rtc_calendar_config
15.6.1.3. Struct rtc_calendar_events
15.6.1.4. Struct rtc_calendar_time
15.6.1.5. Struct rtc_tamper_config
15.6.1.6. Struct rtc_tamper_input_config
15.6.2. Function Definitions
15.6.2.1. Macro FEATURE_RTC_PERIODIC_INT
15.6.2.2. Macro FEATURE_RTC_PRESCALER_OFF
15.6.2.3. Macro FEATURE_RTC_CLOCK_SELECTION
15.6.2.4. Macro FEATURE_RTC_GENERAL_PURPOSE_REG
15.6.2.5. Macro FEATURE_RTC_TAMPER_DETECTION
15.6.2.6. Macro RTC_TAMPER_DETECT_EVT
15.6.2.7. Macro RTC_TAMPER_DETECT_ID0
15.6.2.8. Macro RTC_TAMPER_DETECT_ID1
15.6.2.9. Macro RTC_TAMPER_DETECT_ID2
15.6.2.10. Macro RTC_TAMPER_DETECT_ID3
15.6.2.11. Macro RTC_TAMPER_DETECT_ID4
15.6.3. Peripheral Lock and Unlock
15.6.3.1. APIs available for SAM L21/L22/C20/C21.
15.6.3.1.1. Function rtc_calendar_get_time_defaults()
15.6.3.1.2. Function rtc_calendar_get_config_defaults()
15.6.3.1.3. Function rtc_calendar_reset()
15.6.3.1.4. Function rtc_calendar_enable()
15.6.3.1.5. Function rtc_calendar_disable()
15.6.3.1.6. Function rtc_calendar_init()
15.6.3.1.7. Function rtc_calendar_swap_time_mode()
15.6.3.1.8. Function rtc_calendar_frequency_correction()
15.6.3.2. Driver Initialization and Configuration
15.6.3.2.1. Function rtc_calendar_time_to_register_value()
15.6.3.2.2. Function rtc_calendar_register_value_to_time()
15.6.3.2.3. Function rtc_calendar_set_time()
15.6.3.2.4. Function rtc_calendar_get_time()
15.6.3.2.5. Function rtc_calendar_set_alarm()
15.6.3.2.6. Function rtc_calendar_get_alarm()
15.6.3.3. Enable/Disable
15.6.3.3.1. Function rtc_calendar_is_overflow()
15.6.3.3.2. Function rtc_calendar_clear_overflow()
15.6.3.3.3. Function rtc_calendar_is_periodic_interval()
15.6.3.3.4. Function rtc_calendar_clear_periodic_interval()
15.6.3.3.5. Function rtc_calendar_is_alarm_match()
15.6.3.3.6. Function rtc_calendar_clear_alarm_match()
15.6.3.4. Lock/Unlock
15.6.3.4.1. Function rtc_calendar_enable_events()
15.6.3.4.2. Function rtc_calendar_disable_events()
15.6.3.5. Ready to Write/Read
15.6.3.5.1. Function rtc_write_general_purpose_reg()
15.6.3.5.2. Function rtc_read_general_purpose_reg()
15.6.3.6. Read/Write
15.6.3.6.1. Function rtc_calendar_register_callback()
15.6.3.6.2. Function rtc_calendar_unregister_callback()
15.6.3.6.3. Function rtc_calendar_enable_callback()
15.6.3.6.4. Function rtc_calendar_disable_callback()
15.6.3.7. Callback Management
15.6.3.7.1. Function rtc_tamper_get_config_defaults()
15.6.3.7.2. Function rtc_tamper_set_config()
15.6.3.7.3. Function rtc_tamper_get_detect_flag()
15.6.3.7.4. Function rtc_tamper_clear_detect_flag()
15.6.3.8. Function rtc_tamper_get_stamp()
15.6.4. Writing and Reading
15.6.4.1. Enum rtc_calendar_alarm
15.6.4.2. Enum rtc_calendar_alarm_mask
15.6.4.3. Enum rtc_calendar_callback
15.6.4.4. Enum rtc_calendar_periodic_interval
15.6.4.5. Enum rtc_calendar_prescaler
15.6.4.6. Enum rtc_clock_sel
15.6.4.7. Enum rtc_tamper_active_layer_freq_divider
15.6.4.8. Enum rtc_tamper_debounce_freq_divider
15.6.4.9. Enum rtc_tamper_debounce_seq
15.6.4.10. Enum rtc_tamper_input_action
15.6.4.11. Enum rtc_tamper_level_sel
15.7. RTC Tamper Detect
15.8. Extra Information for RTC (CAL) Driver
15.8.1. Acronyms
15.8.2. Dependencies
15.8.3. Errata
15.8.4. Module History
15.9. Examples for RTC CAL Driver
15.9.1. Quick Start Guide for RTC (CAL) - Basic
15.9.1.1. Prerequisites
15.9.1.1.1. Clocks and Oscillators
15.9.1.2. Setup
15.9.1.2.1. Initialization Code
15.9.1.2.2. Add to Main
15.9.1.2.3. Workflow
15.9.1.3. Implementation
15.9.1.3.1. Workflow
15.9.2. Quick Start Guide for RTC (CAL) - Callback
15.9.2.1. Prerequisites
15.9.2.1.1. Clocks and Oscillators
15.9.2.2. Setup
15.9.2.2.1. Code
15.9.2.2.2. Workflow
15.9.2.3. Implementation
15.9.2.3.1. Code
15.9.2.3.2. Workflow
15.9.2.4. Callback
15.9.2.4.1. Workflow
16. SAM Serial USART (SERCOM USART) Driver
16.1. Prerequisites
16.2. Module Overview
16.2.1. Driver Feature Macro Definition
16.2.2. Frame Format
16.2.3. Synchronous Mode
16.2.3.1. Data Sampling
16.2.4. Asynchronous Mode
16.2.4.1. Transmitter/receiver Clock Matching
16.2.5. Parity
16.2.6. GPIO Configuration
16.3. Special Considerations
16.4. Extra Information
16.5. Examples
16.6. API Overview
16.6.1. Macro Definitions
16.6.1.1. Type usart_callback_t
16.6.2. Function Definitions
16.6.2.1. Struct iso7816_config_t
16.6.2.2. Struct usart_config
16.6.2.3. Struct usart_module
16.6.3. Peripheral Lock and Unlock
16.6.3.1. Driver Feature Definition
16.6.3.1.1. Macro FEATURE_USART_SYNC_SCHEME_V2
16.6.3.1.2. Macro FEATURE_USART_OVER_SAMPLE
16.6.3.1.3. Macro FEATURE_USART_HARDWARE_FLOW_CONTROL
16.6.3.1.4. Macro FEATURE_USART_IRDA
16.6.3.1.5. Macro FEATURE_USART_LIN_SLAVE
16.6.3.1.6. Macro FEATURE_USART_COLLISION_DECTION
16.6.3.1.7. Macro FEATURE_USART_START_FRAME_DECTION
16.6.3.1.8. Macro FEATURE_USART_IMMEDIATE_BUFFER_OVERFLOW_NOTIFICATION
16.6.3.1.9. Macro FEATURE_USART_ISO7816
16.6.3.1.10. Macro FEATURE_USART_LIN_MASTER
16.6.3.1.11. Macro FEATURE_USART_RS485
16.6.3.2. Macro PINMUX_DEFAULT
16.6.3.3. Macro PINMUX_UNUSED
16.6.3.4. Macro USART_TIMEOUT
16.6.4. APIs available for SAM L21/L22/C20/C21.
16.6.4.1. Driver Initialization and Configuration
16.6.4.1.1. Function usart_lock()
16.6.4.1.2. Function usart_unlock()
16.6.4.2. Enable/Disable
16.6.4.2.1. Function usart_write_wait()
16.6.4.2.2. Function usart_read_wait()
16.6.4.2.3. Function usart_write_buffer_wait()
16.6.4.2.4. Function usart_read_buffer_wait()
16.6.4.3. Lock/Unlock
16.6.4.3.1. Function usart_enable_transceiver()
16.6.4.3.2. Function usart_disable_transceiver()
16.6.4.4. Ready to Write/Read
16.6.4.4.1. Function lin_master_send_cmd()
16.6.4.4.2. Function lin_master_transmission_status()
16.6.4.5. Read/Write
16.6.4.5.1. Function usart_register_callback()
16.6.4.5.2. Function usart_unregister_callback()
16.6.4.5.3. Function usart_enable_callback()
16.6.4.5.4. Function usart_disable_callback()
16.6.4.6. Callback Management
16.6.4.6.1. Function usart_write_job()
16.6.4.6.2. Function usart_read_job()
16.6.4.6.3. Function usart_write_buffer_job()
16.6.4.6.4. Function usart_read_buffer_job()
16.6.4.6.5. Function usart_abort_job()
16.6.4.6.6. Function usart_get_job_status()
16.6.4.7. Function usart_disable()
16.6.4.8. Function usart_enable()
16.6.4.9. Function usart_get_config_defaults()
16.6.4.10. Function usart_init()
16.6.4.11. Function usart_is_syncing()
16.6.4.12. Function usart_reset()
16.6.5. Writing and Reading
16.6.5.1. Enum iso7816_guard_time
16.6.5.2. Enum iso7816_inhibit_nack
16.6.5.3. Enum iso7816_protocol_type
16.6.5.4. Enum iso7816_successive_recv_nack
16.6.5.5. Enum lin_master_break_length
16.6.5.6. Enum lin_master_cmd
16.6.5.7. Enum lin_master_header_delay
16.6.5.8. Enum lin_node_type
16.6.5.9. Enum rs485_guard_time
16.6.5.10. Enum usart_callback
16.6.5.11. Enum usart_character_size
16.6.5.12. Enum usart_dataorder
16.6.5.13. Enum usart_parity
16.6.5.14. Enum usart_sample_adjustment
16.6.5.15. Enum usart_sample_rate
16.6.5.16. Enum usart_signal_mux_settings
16.6.5.17. Enum usart_stopbits
16.6.5.18. Enum usart_transceiver_type
16.6.5.19. Enum usart_transfer_mode
16.7. Extra Information for SERCOM USART Driver
16.7.1. Acronyms
16.7.2. Dependencies
16.7.3. Errata
16.7.4. Module History
16.8. Examples for SERCOM USART Driver
16.8.1. Quick Start Guide for SERCOM USART - Basic
16.8.1.1. Setup
16.8.1.1.1. Prerequisites
16.8.1.1.2. Code
16.8.1.1.3. Workflow
16.8.1.2. Use Case
16.8.1.2.1. Code
16.8.1.2.2. Workflow
16.8.2. Quick Start Guide for SERCOM USART - Callback
16.8.2.1. Setup
16.8.2.1.1. Prerequisites
16.8.2.1.2. Code
16.8.2.1.3. Workflow
16.8.2.2. Use Case
16.8.2.2.1. Code
16.8.2.2.2. Workflow
16.8.3. Quick Start Guide for Using DMA with SERCOM USART
16.8.3.1. Setup
16.8.3.1.1. Prerequisites
16.8.3.1.2. Code
16.8.3.1.3. Workflow
16.8.3.1.3.1. Create variables
16.8.3.1.3.2. Configure the USART
16.8.3.1.3.3. Configure DMA
16.8.3.2. Use Case
16.8.3.2.1. Code
16.8.3.2.2. Workflow
16.8.4. Quick Start Guide for SERCOM USART LIN
16.8.4.1. Setup
16.8.4.1.1. Prerequisites
16.8.4.1.2. Code
16.8.4.1.3. Workflow
16.8.4.2. Use Case
16.8.4.2.1. Code
16.8.4.2.2. Workflow
16.9. SERCOM USART MUX Settings
17. SAM I2C Master Mode (SERCOM I2C) Driver
17.1. Prerequisites
17.2. Module Overview
17.2.1. Driver Feature Macro Definition
17.2.2. Functional Description
17.2.3. Bus Topology
17.2.4. Transactions
17.2.4.1. Address Packets
17.2.4.2. Data Packets
17.2.4.3. Transaction Examples
17.2.4.4. Packet Timeout
17.2.4.5. Repeated Start
17.2.5. Multi Master
17.2.5.1. Arbitration
17.2.5.2. Clock Synchronization
17.2.6. Bus States
17.2.7. Bus Timing
17.2.7.1. Unknown Bus State Timeout
17.2.7.2. SDA Hold Timeout
17.2.8. Operation in Sleep Modes
17.3. Special Considerations
17.3.1. Interrupt-driven Operation
17.4. Extra Information
17.5. Examples
17.6. API Overview
17.6.1. Macro Definitions
17.6.1.1. Struct i2c_master_config
17.6.1.2. Struct i2c_master_module
17.6.1.3. Struct i2c_master_packet
17.6.2. Function Definitions
17.6.2.1. Driver Feature Definition
17.6.2.1.1. Macro FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED
17.6.2.1.2. Macro FEATURE_I2C_10_BIT_ADDRESS
17.6.2.1.3. Macro FEATURE_I2C_SCL_STRETCH_MODE
17.6.2.1.4. Macro FEATURE_I2C_SCL_EXTEND_TIMEOUT
17.6.2.1.5. Macro FEATURE_I2C_DMA_SUPPORT
17.6.3. Peripheral Lock and Unlock
17.6.3.1. APIs available for SAM L21/L22/C20/C21.
17.6.3.1.1. Function i2c_master_lock()
17.6.3.1.2. Function i2c_master_unlock()
17.6.3.2. Driver Initialization and Configuration
17.6.3.2.1. Function i2c_master_is_syncing()
17.6.3.2.2. Function i2c_master_get_config_defaults()
17.6.3.2.3. Function i2c_master_init()
17.6.3.2.4. Function i2c_master_enable()
17.6.3.2.5. Function i2c_master_disable()
17.6.3.2.6. Function i2c_master_reset()
17.6.3.3. Enable/Disable
17.6.3.3.1. Function i2c_master_read_packet_wait()
17.6.3.3.2. Function i2c_master_read_packet_wait_no_stop()
17.6.3.3.3. Function i2c_master_write_packet_wait()
17.6.3.3.4. Function i2c_master_write_packet_wait_no_stop()
17.6.3.3.5. Function i2c_master_send_stop()
17.6.3.3.6. Function i2c_master_send_nack()
17.6.3.3.7. Function i2c_master_read_byte()
17.6.3.3.8. Function i2c_master_write_byte()
17.6.3.3.9. Function i2c_master_read_packet_wait_no_nack()
17.6.3.4. Lock/Unlock
17.6.3.4.1. Function i2c_master_dma_set_transfer()
17.6.3.5. Ready to Write/Read
17.6.3.5.1. Function i2c_master_register_callback()
17.6.3.5.2. Function i2c_master_unregister_callback()
17.6.3.5.3. Function i2c_master_enable_callback()
17.6.3.5.4. Function i2c_master_disable_callback()
17.6.3.6. Read/Write
17.6.3.6.1. Function i2c_master_read_bytes()
17.6.3.6.2. Function i2c_master_read_packet_job()
17.6.3.6.3. Function i2c_master_read_packet_job_no_stop()
17.6.3.6.4. Function i2c_master_read_packet_job_no_nack()
17.6.3.6.5. Function i2c_master_write_bytes()
17.6.3.6.6. Function i2c_master_write_packet_job()
17.6.3.6.7. Function i2c_master_write_packet_job_no_stop()
17.6.3.6.8. Function i2c_master_cancel_job()
17.6.3.6.9. Function i2c_master_get_job_status()
17.6.4. Callback Management
17.6.4.1. Enum i2c_master_baud_rate
17.6.4.2. Enum i2c_master_callback
17.6.4.3. Enum i2c_master_inactive_timeout
17.6.4.4. Enum i2c_master_interrupt_flag
17.6.4.5. Enum i2c_master_start_hold_time
17.6.4.6. Enum i2c_master_transfer_speed
17.6.4.7. Enum i2c_transfer_direction
17.7. Extra Information for SERCOM I2C Driver
17.7.1. Acronyms
17.7.2. Dependencies
17.7.3. Errata
17.7.4. Module History
17.8. Examples for SERCOM I2C Driver
17.8.1. Quick Start Guide for SERCOM I2C Master - Basic
17.8.1.1. Prerequisites
17.8.1.2. Setup
17.8.1.2.1. Code
17.8.1.2.2. Workflow
17.8.1.3. Implementation
17.8.1.3.1. Code
17.8.1.3.2. Workflow
17.8.2. Quick Start Guide for SERCOM I2C Master - Callback
17.8.2.1. Prerequisites
17.8.2.2. Setup
17.8.2.2.1. Code
17.8.2.2.2. Workflow
17.8.2.3. Implementation
17.8.2.3.1. Code
17.8.2.3.2. Workflow
17.8.2.4. Callback
17.8.2.4.1. Workflow
17.8.3. Quick Start Guide for Using DMA with SERCOM I2C Master
17.8.3.1. Prerequisites
17.8.3.2. Setup
17.8.3.2.1. Code
17.8.3.2.2. Workflow
17.8.3.3. Implementation
17.8.3.3.1. Code
17.8.3.3.2. Workflow
18. SAM I2C Slave Mode (SERCOM I2C) Driver
18.1. Prerequisites
18.2. Module Overview
18.2.1. Driver Feature Macro Definition
18.2.2. Functional Description
18.2.3. Bus Topology
18.2.4. Transactions
18.2.4.1. Address Packets
18.2.4.2. Data Packets
18.2.4.3. Transaction Examples
18.2.4.4. Packet Timeout
18.2.4.5. Repeated Start
18.2.5. Multi Master
18.2.5.1. Arbitration
18.2.5.2. Clock Synchronization
18.2.6. Bus States
18.2.7. Bus Timing
18.2.7.1. Unknown Bus State Timeout
18.2.7.2. SDA Hold Timeout
18.2.8. Operation in Sleep Modes
18.3. Special Considerations
18.3.1. Interrupt-driven Operation
18.4. Extra Information
18.5. Examples
18.6. API Overview
18.6.1. Macro Definitions
18.6.1.1. Struct i2c_slave_config
18.6.1.2. Struct i2c_slave_module
18.6.1.3. Struct i2c_slave_packet
18.6.2. Function Definitions
18.6.2.1. Driver Feature Definition
18.6.2.1.1. Macro FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED
18.6.2.1.2. Macro FEATURE_I2C_10_BIT_ADDRESS
18.6.2.1.3. Macro FEATURE_I2C_SCL_STRETCH_MODE
18.6.2.1.4. Macro FEATURE_I2C_SCL_EXTEND_TIMEOUT
18.6.2.1.5. Macro FEATURE_I2C_DMA_SUPPORT
18.6.2.2. I2C Slave Status Flags
18.6.2.2.1. Macro I2C_SLAVE_STATUS_ADDRESS_MATCH
18.6.2.2.2. Macro I2C_SLAVE_STATUS_DATA_READY
18.6.2.2.3. Macro I2C_SLAVE_STATUS_STOP_RECEIVED
18.6.2.2.4. Macro I2C_SLAVE_STATUS_CLOCK_HOLD
18.6.2.2.5. Macro I2C_SLAVE_STATUS_SCL_LOW_TIMEOUT
18.6.2.2.6. Macro I2C_SLAVE_STATUS_REPEATED_START
18.6.2.2.7. Macro I2C_SLAVE_STATUS_RECEIVED_NACK
18.6.2.2.8. Macro I2C_SLAVE_STATUS_COLLISION
18.6.2.2.9. Macro I2C_SLAVE_STATUS_BUS_ERROR
18.6.3. Peripheral Lock and Unlock
18.6.3.1. APIs available for SAM L21/L22/C20/C21.
18.6.3.1.1. Function i2c_slave_lock()
18.6.3.1.2. Function i2c_slave_unlock()
18.6.3.2. Driver Initialization and Configuration
18.6.3.2.1. Function i2c_slave_is_syncing()
18.6.3.2.2. Function i2c_slave_get_config_defaults()
18.6.3.2.3. Function i2c_slave_init()
18.6.3.2.4. Function i2c_slave_enable()
18.6.3.2.5. Function i2c_slave_disable()
18.6.3.2.6. Function i2c_slave_reset()
18.6.3.3. Enable/Disable
18.6.3.3.1. Function i2c_slave_write_packet_wait()
18.6.3.3.2. Function i2c_slave_read_packet_wait()
18.6.3.3.3. Function i2c_slave_get_direction_wait()
18.6.3.4. Lock/Unlock
18.6.3.4.1. Function i2c_slave_get_status()
18.6.3.4.2. Function i2c_slave_clear_status()
18.6.3.5. Ready to Write/Read
18.6.3.5.1. Function i2c_slave_dma_read_interrupt_status()
18.6.3.5.2. Function i2c_slave_dma_write_interrupt_status()
18.6.3.6. Read/Write
18.6.3.6.1. Function i2c_slave_enable_nack_on_address()
18.6.3.6.2. Function i2c_slave_disable_nack_on_address()
18.6.3.7. Callback Management
18.6.3.7.1. Function i2c_slave_register_callback()
18.6.3.7.2. Function i2c_slave_unregister_callback()
18.6.3.7.3. Function i2c_slave_enable_callback()
18.6.3.7.4. Function i2c_slave_disable_callback()
18.6.3.8. Writing and Reading
18.6.3.8.1. Function i2c_slave_read_packet_job()
18.6.3.8.2. Function i2c_slave_write_packet_job()
18.6.3.8.3. Function i2c_slave_cancel_job()
18.6.3.8.4. Function i2c_slave_get_job_status()
18.6.4. Enumeration Definitions
18.6.4.1. Enum i2c_slave_address_mode
18.6.4.2. Enum i2c_slave_callback
18.6.4.3. Enum i2c_slave_direction
18.6.4.4. Enum i2c_slave_sda_hold_time
18.6.4.5. Enum i2c_slave_transfer_speed
18.6.4.6. Enum i2c_transfer_direction
18.7. Extra Information for SERCOM I2C Driver
18.7.1. Acronyms
18.7.2. Dependencies
18.7.3. Errata
18.7.4. Module History
18.8. Examples for SERCOM I2C Driver
18.8.1. Quick Start Guide for SERCOM I2C Slave - Basic
18.8.1.1. Prerequisites
18.8.1.2. Setup
18.8.1.2.1. Code
18.8.1.2.2. Workflow
18.8.1.3. Implementation
18.8.1.3.1. Code
18.8.1.3.2. Workflow
18.8.2. Quick Start Guide for SERCOM I2C Slave - Callback
18.8.2.1. Prerequisites
18.8.2.2. Setup
18.8.2.2.1. Code
18.8.2.2.2. Workflow
18.8.2.3. Implementation
18.8.2.3.1. Code
18.8.2.3.2. Workflow
18.8.2.4. Callback
18.8.2.4.1. Workflow
18.8.3. Quick Start Guide for Using DMA with SERCOM I2C Slave
18.8.3.1. Prerequisites
18.8.3.2. Setup
18.8.3.2.1. Code
18.8.3.2.2. Workflow
18.8.3.3. Implementation
18.8.3.3.1. Code
18.8.3.3.2. Workflow
19. SAM Serial Peripheral Interface (SERCOM SPI) Driver
19.1. Prerequisites
19.2. Module Overview
19.2.1. Driver Feature Macro Definition
19.2.2. SPI Bus Connection
19.2.3. SPI Character Size
19.2.4. Master Mode
19.2.4.1. Data Transfer
19.2.5. Slave Mode
19.2.5.1. Data Transfer
19.2.5.2. Address Recognition
19.2.6. Data Modes
19.2.7. SERCOM Pads
19.2.8. Operation in Sleep Modes
19.2.9. Clock Generation
19.3. Special Considerations
19.3.1. pinmux Settings
19.4. Extra Information
19.5. Examples
19.6. API Overview
19.6.1. Macro Definitions
19.6.1.1. Type spi_callback_t
19.6.2. Function Definitions
19.6.2.1. Struct spi_config
19.6.2.2. Union spi_config.mode_specific
19.6.2.3. Struct spi_master_config
19.6.2.4. Struct spi_module
19.6.2.5. Struct spi_slave_config
19.6.2.6. Struct spi_slave_inst
19.6.2.7. Struct spi_slave_inst_config
19.6.3. Peripheral Lock and Unlock
19.6.3.1. Driver Feature Definition
19.6.3.1.1. Macro FEATURE_SPI_SLAVE_SELECT_LOW_DETECT
19.6.3.1.2. Macro FEATURE_SPI_HARDWARE_SLAVE_SELECT
19.6.3.1.3. Macro FEATURE_SPI_ERROR_INTERRUPT
19.6.3.1.4. Macro FEATURE_SPI_SYNC_SCHEME_VERSION_2
19.6.3.2. Macro PINMUX_DEFAULT
19.6.3.3. Macro PINMUX_UNUSED
19.6.3.4. Macro SPI_TIMEOUT
19.6.4. APIs available for SAM L21/L22/C20/C21.
19.6.4.1. Driver Initialization and Configuration
19.6.4.1.1. Function spi_get_config_defaults()
19.6.4.1.2. Function spi_slave_inst_get_config_defaults()
19.6.4.1.3. Function spi_attach_slave()
19.6.4.1.4. Function spi_init()
19.6.4.2. Enable/Disable
19.6.4.2.1. Function spi_enable()
19.6.4.2.2. Function spi_disable()
19.6.4.2.3. Function spi_reset()
19.6.4.3. Lock/Unlock
19.6.4.3.1. Function spi_lock()
19.6.4.3.2. Function spi_unlock()
19.6.4.4. Ready to Write/Read
19.6.4.4.1. Function spi_is_write_complete()
19.6.4.4.2. Function spi_is_ready_to_write()
19.6.4.4.3. Function spi_is_ready_to_read()
19.6.4.5. Read/Write
19.6.4.5.1. Function spi_write()
19.6.4.5.2. Function spi_write_buffer_wait()
19.6.4.5.3. Function spi_read()
19.6.4.5.4. Function spi_read_buffer_wait()
19.6.4.5.5. Function spi_transceive_wait()
19.6.4.5.6. Function spi_transceive_buffer_wait()
19.6.4.5.7. Function spi_select_slave()
19.6.4.6. Callback Management
19.6.4.6.1. Function spi_register_callback()
19.6.4.6.2. Function spi_unregister_callback()
19.6.4.6.3. Function spi_enable_callback()
19.6.4.6.4. Function spi_disable_callback()
19.6.4.7. Writing and Reading
19.6.4.7.1. Function spi_write_buffer_job()
19.6.4.7.2. Function spi_read_buffer_job()
19.6.4.7.3. Function spi_transceive_buffer_job()
19.6.4.7.4. Function spi_abort_job()
19.6.4.7.5. Function spi_get_job_status()
19.6.4.7.6. Function spi_get_job_status_wait()
19.6.4.8. Function spi_is_syncing()
19.6.4.9. Function spi_set_baudrate()
19.6.5. Enumeration Definitions
19.6.5.1. Enum spi_addr_mode
19.6.5.2. Enum spi_callback
19.6.5.3. Enum spi_character_size
19.6.5.4. Enum spi_data_order
19.6.5.5. Enum spi_frame_format
19.6.5.6. Enum spi_interrupt_flag
19.6.5.7. Enum spi_mode
19.6.5.8. Enum spi_signal_mux_setting
19.6.5.9. Enum spi_transfer_mode
19.7. Extra Information for SERCOM SPI Driver
19.7.1. Acronyms
19.7.2. Dependencies
19.7.3. Workarounds Implemented by Driver
19.7.4. Module History
19.8. Examples for SERCOM SPI Driver
19.8.1. Quick Start Guide for SERCOM SPI Master - Polled
19.8.1.1. Setup
19.8.1.1.1. Prerequisites
19.8.1.1.2. Code
19.8.1.2. Workflow
19.8.1.3. Use Case
19.8.1.3.1. Code
19.8.1.3.2. Workflow
19.8.2. Quick Start Guide for SERCOM SPI Slave - Polled
19.8.2.1. Setup
19.8.2.1.1. Prerequisites
19.8.2.1.2. Code
19.8.2.1.3. Workflow
19.8.2.2. Use Case
19.8.2.2.1. Code
19.8.2.2.2. Workflow
19.8.3. Quick Start Guide for SERCOM SPI Master - Callback
19.8.3.1. Setup
19.8.3.1.1. Prerequisites
19.8.3.1.2. Code
19.8.3.2. Workflow
19.8.3.3. Use Case
19.8.3.3.1. Code
19.8.3.3.2. Workflow
19.8.3.4. Callback
19.8.3.4.1. Workflow
19.8.4. Quick Start Guide for SERCOM SPI Slave - Callback
19.8.4.1. Setup
19.8.4.1.1. Prerequisites
19.8.4.1.2. Code
19.8.4.1.3. Workflow
19.8.4.2. Use Case
19.8.4.2.1. Code
19.8.4.2.2. Workflow
19.8.4.3. Callback
19.8.4.3.1. Workflow
19.8.5. Quick Start Guide for Using DMA with SERCOM SPI
19.8.5.1. Setup
19.8.5.1.1. Prerequisites
19.8.5.1.2. Code
19.8.5.1.3. Workflow
19.8.5.2. Use Case
19.8.5.2.1. Code
19.8.5.2.2. Workflow
19.9. MUX Settings
19.9.1. Master Mode Settings
19.9.2. Slave Mode Settings
20. SAM System (SYSTEM) Driver
20.1. Prerequisites
20.2. Module Overview
20.2.1. Voltage Regulator
20.2.2. Battery Backup Power Switch
20.2.3. Voltage References
20.2.4. System Reset Cause
20.2.5. Performance Level
20.2.6. Power Domain Gating
20.2.7. RAMs Low Power Mode
20.2.8. Sleep Modes
20.3. Special Considerations
20.4. Extra Information
20.5. Examples
20.6. API Overview
20.6.1. Macro Definitions
20.6.1.1. Struct system_battery_backup_power_switch_config
20.6.1.2. Struct system_standby_config
20.6.1.3. Struct system_voltage_references_config
20.6.1.4. Struct system_voltage_regulator_config
20.6.2. Function Definitions
20.6.2.1. Peripheral Lock and Unlock
20.6.2.1.1. Function system_voltage_regulator_get_config_defaults()
20.6.2.1.2. Function system_voltage_regulator_set_config()
20.6.2.1.3. Function system_voltage_regulator_enable()
20.6.2.1.4. Function system_voltage_regulator_disable()
20.6.2.2. APIs available for SAM L21/L22/C20/C21.
20.6.2.2.1. Function system_voltage_reference_get_config_defaults()
20.6.2.2.2. Function system_voltage_reference_set_config()
20.6.2.2.3. Function system_voltage_reference_enable()
20.6.2.2.4. Function system_voltage_reference_disable()
20.6.2.3. Driver Initialization and Configuration
20.6.2.3.1. Function system_battery_backup_power_switch_get_config_defaults()
20.6.2.3.2. Function system_battery_backup_power_switch_set_config()
20.6.2.4. Enable/Disable
20.6.2.4.1. Function system_backup_pin_output_enable()
20.6.2.4.2. Function system_backup_pin_output_disable()
20.6.2.4.3. Function system_backup_pin_output_is_enabled()
20.6.2.4.4. Function system_backup_pin_output_enable_rtc_toggle()
20.6.2.4.5. Function system_backup_pin_output_disable_rtc_toggle()
20.6.2.4.6. Function system_backup_pin_output_set()
20.6.2.4.7. Function system_backup_pin_output_clear()
20.6.2.4.8. Function system_backup_pin_output_get()
20.6.2.5. Lock/Unlock
20.6.2.5.1. Function system_set_sleepmode()
20.6.2.5.2. Function system_sleep()
20.6.2.6. Ready to Write/Read
20.6.2.6.1. Function system_switch_performance_level()
20.6.2.6.2. Function system_get_performance_level()
20.6.2.6.3. Function system_get_performance_level_status()
20.6.2.6.4. Function system_clear_performance_level_status()
20.6.2.7. Read/Write
20.6.2.7.1. Function system_standby_get_config_defaults()
20.6.2.7.2. Function system_standby_set_config()
20.6.2.8. Callback Management
20.6.2.8.1. Function system_io_retension_enable()
20.6.2.8.2. Function system_io_retension_disable()
20.6.2.9. Writing and Reading
20.6.2.9.1. Function system_reset()
20.6.2.9.2. Function system_get_reset_cause()
20.6.2.10. Enumeration Definitions
20.6.2.10.1. Function system_get_backup_exit_source()
20.6.2.11. System Debugger
20.6.2.11.1. Function system_is_debugger_present()
20.6.2.12. System Identification
20.6.2.12.1. Function system_get_device_id()
20.6.2.13. System Initialization
20.6.2.13.1. Function system_init()
20.6.3. Enumeration Definitions
20.6.3.1. Enum system_backup_pin
20.6.3.2. Enum system_battery_power_switch
20.6.3.3. Enum system_performance_level
20.6.3.4. Enum system_ram_back_bias_mode
20.6.3.5. Enum system_reset_backup_exit_source
20.6.3.6. Enum system_reset_cause
20.6.3.7. Enum system_sleepmode
20.6.3.8. Enum system_voltage_reference
20.6.3.9. Enum system_voltage_references_sel
20.6.3.10. Enum system_voltage_regulator_low_power_efficiency
20.6.3.11. Enum system_voltage_regulator_sel
20.7. Examples for Power Driver
20.7.1. Quick Start Guide for Power Driver
20.7.1.1. Quick Start
20.7.1.1.1. Prerequisites
20.7.1.1.2. Code
20.7.1.1.3. Workflow
20.7.1.2. Use Case
20.7.1.2.1. Code
20.7.1.2.2. Workflow
20.8. Extra Information for SYSTEM Driver
20.8.1. Acronyms
20.8.2. Dependencies
20.8.3. Errata
20.8.4. Module History
21. SAM System Clock Management (SYSTEM CLOCK) Driver
21.1. Prerequisites
21.2. Module Overview
21.2.1. Clock Sources
21.2.2. CPU / Bus Clocks
21.2.3. Clock Masking
21.2.4. Generic Clocks
21.2.4.1. Clock Chain Example
21.2.4.2. Generic Clock Generators
21.2.4.3. Generic Clock Channels
21.3. Special Considerations
21.4. Extra Information
21.5. Examples
21.6. API Overview
21.6.1. Macro Definitions
21.6.1.1. Struct system_clock_source_dfll_config
21.6.1.2. Struct system_clock_source_dpll_config
21.6.1.3. Struct system_clock_source_osc16m_config
21.6.1.4. Struct system_clock_source_osc32k_config
21.6.1.5. Struct system_clock_source_osculp32k_config
21.6.1.6. Struct system_clock_source_xosc32k_config
21.6.1.7. Struct system_clock_source_xosc_config
21.6.1.8. Struct system_gclk_chan_config
21.6.1.9. Struct system_gclk_gen_config
21.6.2. Function Definitions
21.6.2.1. Peripheral Lock and Unlock
21.6.2.1.1. Function system_clock_source_xosc_get_config_defaults()
21.6.2.1.2. Function system_clock_source_xosc_set_config()
21.6.2.2. APIs available for SAM L21/L22/C20/C21.
21.6.2.2.1. Function system_clock_source_xosc32k_get_config_defaults()
21.6.2.2.2. Function system_clock_source_xosc32k_set_config()
21.6.2.3. Driver Initialization and Configuration
21.6.2.3.1. Function system_clock_source_osc32k_get_config_defaults()
21.6.2.3.2. Function system_clock_source_osc32k_set_config()
21.6.2.4. Enable/Disable
21.6.2.4.1. Function system_clock_source_osculp32k_get_config_defaults()
21.6.2.4.2. Function system_clock_source_osculp32k_set_config()
21.6.2.5. Lock/Unlock
21.6.2.5.1. Function system_clock_source_osc16m_get_config_defaults()
21.6.2.5.2. Function system_clock_source_osc16m_set_config()
21.6.2.6. Ready to Write/Read
21.6.2.6.1. Function system_clock_source_dfll_get_config_defaults()
21.6.2.6.2. Function system_clock_source_dfll_set_config()
21.6.2.7. Read/Write
21.6.2.7.1. Function system_clock_source_write_calibration()
21.6.2.7.2. Function system_clock_source_enable()
21.6.2.7.3. Function system_clock_source_disable()
21.6.2.7.4. Function system_clock_source_is_ready()
21.6.2.7.5. Function system_clock_source_get_hz()
21.6.2.8. Callback Management
21.6.2.8.1. Function system_main_clock_set_failure_detect()
21.6.2.8.2. Function system_cpu_clock_set_divider()
21.6.2.8.3. Function system_low_power_clock_set_divider()
21.6.2.8.4. Function system_backup_clock_set_divider()
21.6.2.8.5. Function system_cpu_clock_get_hz()
21.6.2.8.6. Function system_low_power_clock_get_hz()
21.6.2.8.7. Function system_backup_clock_get_hz()
21.6.2.9. Writing and Reading
21.6.2.9.1. Function system_ahb_clock_set_mask()
21.6.2.9.2. Function system_ahb_clock_clear_mask()
21.6.2.9.3. Function system_apb_clock_set_mask()
21.6.2.9.4. Function system_apb_clock_clear_mask()
21.6.2.10. Enumeration Definitions
21.6.2.10.1. Function system_clock_source_dpll_get_config_defaults()
21.6.2.10.2. Function system_clock_source_dpll_set_config()
21.6.2.11. System Debugger
21.6.2.11.1. Function system_clock_init()
21.6.2.12. System Identification
21.6.2.12.1. Function system_flash_set_waitstates()
21.6.2.13. System Initialization
21.6.2.13.1. Function system_gclk_init()
21.6.2.14. Enumeration Definitions
21.6.2.14.1. Function system_gclk_gen_get_config_defaults()
21.6.2.14.2. Function system_gclk_gen_set_config()
21.6.2.14.3. Function system_gclk_gen_enable()
21.6.2.14.4. Function system_gclk_gen_disable()
21.6.2.14.5. Function system_gclk_gen_is_enabled()
21.6.2.15. Generic Clock Management (Channels)
21.6.2.15.1. Function system_gclk_chan_get_config_defaults()
21.6.2.15.2. Function system_gclk_chan_set_config()
21.6.2.15.3. Function system_gclk_chan_enable()
21.6.2.15.4. Function system_gclk_chan_disable()
21.6.2.15.5. Function system_gclk_chan_is_enabled()
21.6.2.15.6. Function system_gclk_chan_lock()
21.6.2.15.7. Function system_gclk_chan_is_locked()
21.6.2.16. Generic Clock Frequency Retrieval
21.6.2.16.1. Function system_gclk_gen_get_hz()
21.6.2.16.2. Function system_gclk_chan_get_hz()
21.6.3. Enumeration Definitions
21.6.3.1. Enum gclk_generator
21.6.3.2. Enum system_clock_apb_bus
21.6.3.3. Enum system_clock_dfll_chill_cycle
21.6.3.4. Enum system_clock_dfll_loop_mode
21.6.3.5. Enum system_clock_dfll_quick_lock
21.6.3.6. Enum system_clock_dfll_stable_tracking
21.6.3.7. Enum system_clock_dfll_wakeup_lock
21.6.3.8. Enum system_clock_external
21.6.3.9. Enum system_clock_source
21.6.3.10. Enum system_clock_source_dpll_filter
21.6.3.11. Enum system_clock_source_dpll_lock_time
21.6.3.12. Enum system_clock_source_dpll_prescaler
21.6.3.13. Enum system_clock_source_dpll_reference_clock
21.6.3.14. Enum system_main_clock_div
21.6.3.15. Enum system_osc16m_fsel
21.6.3.16. Enum system_osc32k_startup
21.6.3.17. Enum system_xosc32k_startup
21.6.3.18. Enum system_xosc_startup
21.7. Extra Information for SYSTEM CLOCK Driver
21.7.1. Acronyms
21.7.2. Dependencies
21.7.3. Errata
21.7.4. Module History
21.8. Examples for System Clock Driver
21.8.1. Quick Start Guide for SYSTEM CLOCK - Basic
21.8.1.1. Setup
21.8.1.1.1. Prerequisites
21.8.1.1.2. Code
21.8.1.1.3. Workflow
21.8.1.2. Use Case
21.8.1.2.1. Code
21.8.1.2.2. Workflow
21.8.2. Quick Start Guide for SYSTEM CLOCK - GCLK Configuration
21.8.2.1. Setup
21.8.2.1.1. Prerequisites
21.8.2.1.2. Code
21.8.2.1.3. Workflow
21.8.2.2. Use Case
21.8.2.2.1. Code
21.8.2.2.2. Workflow
22. SAM System Interrupt (SYSTEM INTERRUPT) Driver
22.1. Prerequisites
22.2. Module Overview
22.2.1. Critical Sections
22.2.2. Software Interrupts
22.3. Special Considerations
22.4. Extra Information
22.5. Examples
22.6. API Overview
22.6.1. Macro Definitions
22.6.1.1. Function Definitions
22.6.1.1.1. Function system_interrupt_enter_critical_section()
22.6.1.1.2. Function system_interrupt_leave_critical_section()
22.6.1.2. Peripheral Lock and Unlock
22.6.1.2.1. Function system_interrupt_is_global_enabled()
22.6.1.2.2. Function system_interrupt_enable_global()
22.6.1.2.3. Function system_interrupt_disable_global()
22.6.1.2.4. Function system_interrupt_is_enabled()
22.6.1.2.5. Function system_interrupt_enable()
22.6.1.2.6. Function system_interrupt_disable()
22.6.1.3. APIs available for SAM L21/L22/C20/C21.
22.6.1.3.1. Function system_interrupt_get_active()
22.6.1.3.2. Function system_interrupt_is_pending()
22.6.1.3.3. Function system_interrupt_set_pending()
22.6.1.3.4. Function system_interrupt_clear_pending()
22.6.1.4. Driver Initialization and Configuration
22.6.1.4.1. Function system_interrupt_set_priority()
22.6.1.4.2. Function system_interrupt_get_priority()
22.6.2. Enable/Disable
22.6.2.1. Enum system_interrupt_priority_level
22.6.2.2. Enum system_interrupt_vector_samc21
22.6.2.3. Enum system_interrupt_vector_samd1x
22.6.2.4. Enum system_interrupt_vector_samd1x
22.6.2.5. Enum system_interrupt_vector_samd20
22.6.2.6. Enum system_interrupt_vector_samd21
22.6.2.7. Enum system_interrupt_vector_samdax
22.6.2.8. Enum system_interrupt_vector_saml21
22.6.2.9. Enum system_interrupt_vector_saml22
22.6.2.10. Enum system_interrupt_vector_samr21
22.7. Extra Information for SYSTEM INTERRUPT Driver
22.7.1. Acronyms
22.7.2. Dependencies
22.7.3. Errata
22.7.4. Module History
22.8. Examples for SYSTEM INTERRUPT Driver
22.8.1. Quick Start Guide for SYSTEM INTERRUPT - Critical Section Use Case
22.8.1.1. Setup
22.8.1.1.1. Prerequisites
22.8.1.2. Use Case
22.8.1.2.1. Code
22.8.1.2.2. Workflow
22.8.2. Quick Start Guide for SYSTEM INTERRUPT - Enable Module Interrupt Use Case
22.8.2.1. Setup
22.8.2.1.1. Prerequisites
22.8.2.2. Use Case
22.8.2.2.1. Code
22.8.2.2.2. Workflow
23. SAM System Pin Multiplexer (SYSTEM PINMUX) Driver
23.1. Prerequisites
23.2. Module Overview
23.2.1. Driver Feature Macro Definition
23.2.2. Physical and Logical GPIO Pins
23.2.3. Peripheral Multiplexing
23.2.4. Special Pad Characteristics
23.2.4.1. Drive Strength
23.2.4.2. Slew Rate
23.2.4.3. Input Sample Mode
23.2.5. Physical Connection
23.3. Special Considerations
23.4. Extra Information
23.5. Examples
23.6. API Overview
23.6.1. Macro Definitions
23.6.1.1. Struct system_pinmux_config
23.6.2. Function Definitions
23.6.2.1. Macro FEATURE_SYSTEM_PINMUX_DRIVE_STRENGTH
23.6.2.2. Macro SYSTEM_PINMUX_GPIO
23.6.3. Peripheral Lock and Unlock
23.6.3.1. APIs available for SAM L21/L22/C20/C21.
23.6.3.1.1. Function system_pinmux_get_config_defaults()
23.6.3.1.2. Function system_pinmux_pin_set_config()
23.6.3.1.3. Function system_pinmux_group_set_config()
23.6.3.2. Driver Initialization and Configuration
23.6.3.2.1. Function system_pinmux_get_group_from_gpio_pin()
23.6.3.2.2. Function system_pinmux_group_set_input_sample_mode()
23.6.3.3. Enable/Disable
23.6.3.3.1. Function system_pinmux_pin_get_mux_position()
23.6.3.3.2. Function system_pinmux_pin_set_input_sample_mode()
23.6.3.4. Function system_pinmux_group_set_output_strength()
23.6.3.5. Function system_pinmux_pin_set_output_strength()
23.6.4. Lock/Unlock
23.6.4.1. Enum system_pinmux_pin_dir
23.6.4.2. Enum system_pinmux_pin_pull
23.6.4.3. Enum system_pinmux_pin_sample
23.6.4.4. Enum system_pinmux_pin_strength
23.7. Extra Information for SYSTEM PINMUX Driver
23.7.1. Acronyms
23.7.2. Dependencies
23.7.3. Errata
23.7.4. Module History
23.8. Examples for SYSTEM PINMUX Driver
23.8.1. Quick Start Guide for SYSTEM PINMUX - Basic
23.8.1.1. Setup
23.8.1.1.1. Prerequisites
23.8.1.1.2. Code
23.8.1.1.3. Workflow
23.8.1.2. Use Case
23.8.1.2.1. Code
23.8.1.2.2. Workflow
24. SAM Timer/Counter Driver (TC)
24.1. Prerequisites
24.2. Module Overview
24.2.1. Driver Feature Macro Definition
24.2.2. Functional Description
24.2.3. Timer/Counter Size
24.2.4. Clock Settings
24.2.4.1. Clock Selection
24.2.4.2. Prescaler
24.2.4.3. Reloading
24.2.5. Compare Match Operations
24.2.5.1. Basic Timer
24.2.5.2. Waveform Generation
24.2.5.3. Waveform Generation - PWM
24.2.5.4. Waveform Generation - Frequency
24.2.5.5. Capture Operations
24.2.5.6. Capture Operations - Event
24.2.5.7. Capture Operations - Pulse Width
24.2.6. One-shot Mode
24.2.6.1. Wave Generation Output Inversion
24.3. Special Considerations
24.4. Extra Information
24.5. Examples
24.6. API Overview
24.6.1. Macro Definitions
24.6.1.1. Type tc_callback_t
24.6.2. Function Definitions
24.6.2.1. Struct tc_16bit_config
24.6.2.2. Struct tc_32bit_config
24.6.2.3. Struct tc_8bit_config
24.6.2.4. Struct tc_config
24.6.2.5. Union tc_config.__unnamed__
24.6.2.6. Struct tc_events
24.6.2.7. Struct tc_module
24.6.2.8. Struct tc_pwm_channel
24.6.3. Peripheral Lock and Unlock
24.6.3.1. Macro FEATURE_TC_DOUBLE_BUFFERED
24.6.3.2. Macro FEATURE_TC_SYNCBUSY_SCHEME_VERSION_2
24.6.3.3. Macro FEATURE_TC_STAMP_PW_CAPTURE
24.6.3.4. Macro FEATURE_TC_READ_SYNC
24.6.3.5. Macro FEATURE_TC_IO_CAPTURE
24.6.3.6. Macro FEATURE_TC_GENERATE_DMA_TRIGGER
24.6.3.7. Module Status Flags
24.6.3.7.1. Macro TC_STATUS_CHANNEL_0_MATCH
24.6.3.7.2. Macro TC_STATUS_CHANNEL_1_MATCH
24.6.3.7.3. Macro TC_STATUS_SYNC_READY
24.6.3.7.4. Macro TC_STATUS_CAPTURE_OVERFLOW
24.6.3.7.5. Macro TC_STATUS_COUNT_OVERFLOW
24.6.3.7.6. Macro TC_STATUS_CHN0_BUFFER_VALID
24.6.3.7.7. Macro TC_STATUS_CHN1_BUFFER_VALID
24.6.3.7.8. Macro TC_STATUS_PERIOD_BUFFER_VALID
24.6.3.8. Macro TC_WAVE_GENERATION_MATCH_FREQ_MODE
24.6.3.9. Macro TC_WAVE_GENERATION_MATCH_PWM_MODE
24.6.3.10. Macro TC_WAVE_GENERATION_NORMAL_FREQ_MODE
24.6.3.11. Macro TC_WAVE_GENERATION_NORMAL_PWM_MODE
24.6.3.12. Macro TC_WAVEFORM_INVERT_CC0_MODE
24.6.3.13. Macro TC_WAVEFORM_INVERT_CC1_MODE
24.6.4. APIs available for SAM L21/L22/C20/C21.
24.6.4.1. Driver Initialization and Configuration
24.6.4.1.1. Function tc_is_syncing()
24.6.4.1.2. Function tc_get_config_defaults()
24.6.4.1.3. Function tc_init()
24.6.4.2. Enable/Disable
24.6.4.2.1. Function tc_enable_events()
24.6.4.2.2. Function tc_disable_events()
24.6.4.3. Lock/Unlock
24.6.4.3.1. Function tc_reset()
24.6.4.3.2. Function tc_enable()
24.6.4.3.3. Function tc_disable()
24.6.4.4. Ready to Write/Read
24.6.4.4.1. Function tc_get_count_value()
24.6.4.4.2. Function tc_set_count_value()
24.6.4.5. Read/Write
24.6.4.5.1. Function tc_stop_counter()
24.6.4.5.2. Function tc_start_counter()
24.6.4.6. Callback Management
24.6.4.6.1. Function tc_update_double_buffer()
24.6.4.7. Writing and Reading
24.6.4.7.1. Function tc_sync_read_count()
24.6.4.8. Enumeration Definitions
24.6.4.8.1. Function tc_dma_trigger_command()
24.6.4.9. System Debugger
24.6.4.9.1. Function tc_get_capture_value()
24.6.4.9.2. Function tc_set_compare_value()
24.6.4.10. System Identification
24.6.4.10.1. Function tc_set_top_value()
24.6.4.11. System Initialization
24.6.4.11.1. Function tc_get_status()
24.6.4.11.2. Function tc_clear_status()
24.6.5. Enumeration Definitions
24.6.5.1. Enum tc_callback
24.6.5.2. Enum tc_clock_prescaler
24.6.5.3. Enum tc_compare_capture_channel
24.6.5.4. Enum tc_count_direction
24.6.5.5. Enum tc_counter_size
24.6.5.6. Enum tc_event_action
24.6.5.7. Enum tc_reload_action
24.6.5.8. Enum tc_wave_generation
24.6.5.9. Enum tc_waveform_invert_output
24.7. Extra Information for TC Driver
24.7.1. Acronyms
24.7.2. Dependencies
24.7.3. Errata
24.7.4. Module History
24.8. Examples for TC Driver
24.8.1. Quick Start Guide for TC - Basic
24.8.1.1. Quick Start
24.8.1.1.1. Prerequisites
24.8.1.1.2. Code
24.8.1.1.3. Workflow
24.8.1.2. Use Case
24.8.1.2.1. Code
24.8.1.2.2. Workflow
24.8.2. Quick Start Guide for TC - Match Frequency Wave Generation
24.8.2.1. Quick Start
24.8.2.1.1. Prerequisites
24.8.2.1.2. Code
24.8.2.1.3. Workflow
24.8.2.2. Use Case
24.8.2.2.1. Code
24.8.2.2.2. Workflow
24.8.3. Quick Start Guide for TC - Timer
24.8.3.1. Quick Start
24.8.3.1.1. Prerequisites
24.8.3.1.2. Code
24.8.3.1.3. Workflow
24.8.3.2. Use Case
24.8.3.2.1. Code
24.8.3.2.2. Workflow
24.8.4. Quick Start Guide for TC - Callback
24.8.4.1. Quick Start
24.8.4.1.1. Prerequisites
24.8.4.1.2. Code
24.8.4.1.3. Workflow
24.8.4.2. Use Case
24.8.4.2.1. Code
24.8.4.2.2. Workflow
24.8.5. Quick Start Guide for Using DMA with TC
24.8.5.1. Quick Start
24.8.5.1.1. Prerequisites
24.8.5.1.2. Code
24.8.5.1.3. Workflow
24.8.5.1.3.1. Create variables
24.8.5.1.3.2. Configure TC
24.8.5.1.3.3. Configure DMA
24.8.5.1.3.4. Prepare data
24.8.5.2. Use Case
24.8.5.2.1. Code
24.8.5.2.2. Workflow
25. SAM Timer Counter for Control Applications Driver (TCC)
25.1. Prerequisites
25.2. Module Overview
25.2.1. Functional Description
25.2.2. Base Timer/Counter
25.2.2.1. Timer/Counter Size
25.2.2.2. Timer/Counter Clock and Prescaler
25.2.2.3. Timer/Counter Control Inputs (Events)
25.2.2.4. Timer/Counter Reloading
25.2.2.5. One-shot Mode
25.2.3. Capture Operations
25.2.3.1. Capture Operations - Event
25.2.3.2. Capture Operations - Pulse Width
25.2.4. Compare Match Operation
25.2.4.1. Basic Timer
25.2.4.2. Waveform Generation
25.2.4.3. Waveform Generation - PWM
25.2.4.4. Waveform Generation - Frequency
25.2.5. Waveform Extended Controls
25.2.5.1. Pattern Generation
25.2.5.2. Recoverable Faults
25.2.5.3. Non-Recoverable Faults
25.2.6. Double and Circular Buffering
25.2.7. Sleep Mode
25.3. Special Considerations
25.3.1. Driver Feature Macro Definition
25.3.2. Module Features
25.3.2.1. SAM TCC Feature List
25.3.2.2. SAM D10/D11 TCC Feature List
25.3.3. Channels vs. Pin outs
25.4. Extra Information
25.5. Examples
25.6. API Overview
25.6.1. Macro Definitions
25.6.1.1. Type tcc_callback_t
25.6.2. Function Definitions
25.6.2.1. Struct tcc_capture_config
25.6.2.2. Struct tcc_config
25.6.2.3. Union tcc_config.__unnamed__
25.6.2.4. Struct tcc_counter_config
25.6.2.5. Struct tcc_events
25.6.2.6. Struct tcc_input_event_config
25.6.2.7. Struct tcc_match_wave_config
25.6.2.8. Struct tcc_module
25.6.2.9. Struct tcc_non_recoverable_fault_config
25.6.2.10. Struct tcc_output_event_config
25.6.2.11. Struct tcc_pins_config
25.6.2.12. Struct tcc_recoverable_fault_config
25.6.2.13. Struct tcc_wave_extension_config
25.6.3. Peripheral Lock and Unlock
25.6.3.1. Macro FEATURE_TCC_GENERATE_DMA_TRIGGER
25.6.3.2. Module Status Flags
25.6.3.2.1. Macro TCC_STATUS_CHANNEL_MATCH_CAPTURE
25.6.3.2.2. Macro TCC_STATUS_CHANNEL_OUTPUT
25.6.3.2.3. Macro TCC_STATUS_NON_RECOVERABLE_FAULT_OCCUR
25.6.3.2.4. Macro TCC_STATUS_RECOVERABLE_FAULT_OCCUR
25.6.3.2.5. Macro TCC_STATUS_NON_RECOVERABLE_FAULT_PRESENT
25.6.3.2.6. Macro TCC_STATUS_RECOVERABLE_FAULT_PRESENT
25.6.3.2.7. Macro TCC_STATUS_SYNC_READY
25.6.3.2.8. Macro TCC_STATUS_CAPTURE_OVERFLOW
25.6.3.2.9. Macro TCC_STATUS_COUNTER_EVENT
25.6.3.2.10. Macro TCC_STATUS_COUNTER_RETRIGGERED
25.6.3.2.11. Macro TCC_STATUS_COUNT_OVERFLOW
25.6.3.2.12. Macro TCC_STATUS_RAMP_CYCLE_INDEX
25.6.3.2.13. Macro TCC_STATUS_STOPPED
25.6.3.3. Macro _TCC_CHANNEL_ENUM_LIST
25.6.3.4. Macro _TCC_ENUM
25.6.3.5. Macro _TCC_WO_ENUM_LIST
25.6.3.6. Macro TCC_NUM_CHANNELS
25.6.3.7. Macro TCC_NUM_FAULTS
25.6.3.8. Macro TCC_NUM_WAVE_OUTPUTS
25.6.4. APIs available for SAM L21/L22/C20/C21.
25.6.4.1. Driver Initialization and Configuration
25.6.4.1.1. Function tcc_is_syncing()
25.6.4.1.2. Function tcc_get_config_defaults()
25.6.4.1.3. Function tcc_init()
25.6.4.2. Enable/Disable
25.6.4.2.1. Function tcc_enable_events()
25.6.4.2.2. Function tcc_disable_events()
25.6.4.3. Lock/Unlock
25.6.4.3.1. Function tcc_enable()
25.6.4.3.2. Function tcc_disable()
25.6.4.3.3. Function tcc_reset()
25.6.4.4. Ready to Write/Read
25.6.4.4.1. Function tcc_set_count_direction()
25.6.4.4.2. Function tcc_toggle_count_direction()
25.6.4.5. Read/Write
25.6.4.5.1. Function tcc_get_count_value()
25.6.4.5.2. Function tcc_set_count_value()
25.6.4.6. Callback Management
25.6.4.6.1. Function tcc_stop_counter()
25.6.4.6.2. Function tcc_restart_counter()
25.6.4.7. Writing and Reading
25.6.4.7.1. Function tcc_dma_trigger_command()
25.6.4.8. Enumeration Definitions
25.6.4.8.1. Function tcc_get_capture_value()
25.6.4.8.2. Function tcc_set_compare_value()
25.6.4.9. System Debugger
25.6.4.9.1. Function tcc_set_top_value()
25.6.4.10. System Identification
25.6.4.10.1. Function tcc_set_pattern()
25.6.4.11. System Initialization
25.6.4.11.1. Function tcc_set_ramp_index()
25.6.4.12. Enumeration Definitions
25.6.4.12.1. Function tcc_is_running()
25.6.4.12.2. Function tcc_get_status()
25.6.4.12.3. Function tcc_clear_status()
25.6.4.13. Generic Clock Management (Channels)
25.6.4.13.1. Function tcc_enable_double_buffering()
25.6.4.13.2. Function tcc_disable_double_buffering()
25.6.4.13.3. Function tcc_lock_double_buffer_update()
25.6.4.13.4. Function tcc_unlock_double_buffer_update()
25.6.4.13.5. Function tcc_force_double_buffer_update()
25.6.4.13.6. Function tcc_enable_circular_buffer_top()
25.6.4.13.7. Function tcc_disable_circular_buffer_top()
25.6.4.13.8. Function tcc_set_double_buffer_top_values()
25.6.4.13.9. Function tcc_enable_circular_buffer_compare()
25.6.4.13.10. Function tcc_disable_circular_buffer_compare()
25.6.4.13.11. Function tcc_set_double_buffer_compare_values()
25.6.5. Generic Clock Frequency Retrieval
25.6.5.1. Enum tcc_callback
25.6.5.2. Enum tcc_channel_function
25.6.5.3. Enum tcc_clock_prescaler
25.6.5.4. Enum tcc_count_direction
25.6.5.5. Enum tcc_count_overflow_dma_trigger_mode
25.6.5.6. Enum tcc_event0_action
25.6.5.7. Enum tcc_event1_action
25.6.5.8. Enum tcc_event_action
25.6.5.9. Enum tcc_event_generation_selection
25.6.5.10. Enum tcc_fault_blanking
25.6.5.11. Enum tcc_fault_capture_action
25.6.5.12. Enum tcc_fault_capture_channel
25.6.5.13. Enum tcc_fault_halt_action
25.6.5.14. Enum tcc_fault_keep
25.6.5.15. Enum tcc_fault_qualification
25.6.5.16. Enum tcc_fault_restart
25.6.5.17. Enum tcc_fault_source
25.6.5.18. Enum tcc_fault_state_output
25.6.5.19. Enum tcc_match_capture_channel
25.6.5.20. Enum tcc_output_invertion
25.6.5.21. Enum tcc_output_pattern
25.6.5.22. Enum tcc_ramp
25.6.5.23. Enum tcc_ramp_index
25.6.5.24. Enum tcc_reload_action
25.6.5.25. Enum tcc_wave_generation
25.6.5.26. Enum tcc_wave_output
25.6.5.27. Enum tcc_wave_polarity
25.7. Extra Information for TCC Driver
25.7.1. Acronyms
25.7.2. Dependencies
25.7.3. Errata
25.7.4. Module History
25.8. Examples for TCC Driver
25.8.1. Quick Start Guide for TCC - Basic
25.8.1.1. Quick Start
25.8.1.1.1. Prerequisites
25.8.1.1.2. Code
25.8.1.1.3. Workflow
25.8.1.2. Use Case
25.8.1.2.1. Code
25.8.1.2.2. Workflow
25.8.2. Quick Start Guide for TCC - Double Buffering and Circular
25.8.2.1. Quick Start
25.8.2.1.1. Prerequisites
25.8.2.1.2. Code
25.8.2.1.3. Workflow
25.8.2.2. Use Case
25.8.2.2.1. Code
25.8.2.2.2. Workflow
25.8.3. Quick Start Guide for TCC - Timer
25.8.3.1. Quick Start
25.8.3.1.1. Prerequisites
25.8.3.1.2. Code
25.8.3.1.3. Workflow
25.8.3.2. Use Case
25.8.3.2.1. Code
25.8.3.2.2. Workflow
25.8.4. Quick Start Guide for TCC - Callback
25.8.4.1. Quick Start
25.8.4.1.1. Prerequisites
25.8.4.1.2. Code
25.8.4.1.3. Workflow
25.8.4.2. Use Case
25.8.4.2.1. Code
25.8.4.2.2. Workflow
25.8.5. Quick Start Guide for TCC - Non-Recoverable Fault
25.8.5.1. Quick Start
25.8.5.1.1. Prerequisites
25.8.5.1.2. Code
25.8.5.1.3. Workflow
25.8.5.1.3.1. Configure TCC
25.8.5.1.3.2. Configure EXTINT for fault input
25.8.5.1.3.3. Configure EVENTS for fault input
25.8.5.2. Use Case
25.8.5.2.1. Code
25.8.5.2.2. Workflow
25.8.6. Quick Start Guide for TCC - Recoverable Fault
25.8.6.1. Quick Start
25.8.6.1.1. Prerequisites
25.8.6.1.2. Code
25.8.6.1.3. Workflow
25.8.6.1.3.1. Configure TCC
25.8.6.1.3.2. Configure EXTINT for fault input
25.8.6.1.3.3. Configure EVENTS for fault input
25.8.6.2. Use Case
25.8.6.2.1. Code
25.8.6.2.2. Workflow
25.8.7. Quick Start Guide for Using DMA with TCC
25.8.7.1. Quick Start
25.8.7.1.1. Prerequisites
25.8.7.1.2. Code
25.8.7.1.3. Workflow
25.8.7.1.3.1. Configure the TCC
25.8.7.1.3.2. Configure the Event System
25.8.7.1.3.3. Configure the DMA for Capture TCC Channel 1
25.8.7.1.3.4. Configure the DMA for Compare TCC Channel 0
25.8.7.2. Use Case
25.8.7.2.1. Code
25.8.7.2.2. Workflow
26. SAM True Random Number Generator (TRNG) Driver
26.1. Prerequisites
26.2. Module Overview
26.3. Special Considerations
26.4. Extra Information
26.5. Examples
26.6. API Overview
26.6.1. Macro Definitions
26.6.1.1. Type trng_callback_t
26.6.1.2. Variable _trng_instance
26.6.2. Function Definitions
26.6.2.1. Struct trng_config
26.6.2.2. Struct trng_events
26.6.2.3. Struct trng_module
26.6.3. Peripheral Lock and Unlock
26.6.3.1. APIs available for SAM L21/L22/C20/C21.
26.6.3.1.1. Function trng_init()
26.6.3.1.2. Function trng_get_config_defaults()
26.6.3.1.3. Function trng_enable()
26.6.3.1.4. Function trng_disable()
26.6.3.1.5. Function trng_enable_events()
26.6.3.1.6. Function trng_disable_events()
26.6.3.2. Driver Initialization and Configuration
26.6.3.2.1. Function trng_read()
26.6.3.3. Enable/Disable
26.6.3.3.1. Function trng_register_callback()
26.6.3.3.2. Function trng_unregister_callback()
26.6.3.3.3. Function trng_enable_callback()
26.6.3.3.4. Function trng_disable_callback()
26.6.3.4. Lock/Unlock
26.6.3.4.1. Function trng_read_buffer_job()
26.6.3.4.2. Function trng_get_job_status()
26.6.3.4.3. Function trng_abort_job()
26.6.4. Ready to Write/Read
26.6.4.1. Enum trng_callback
26.6.4.2. Enum trng_job_type
26.7. Extra Information for TRNG Driver
26.7.1. Acronyms
26.7.2. Dependencies
26.7.3. Errata
26.7.4. Module History
26.8. Examples for TRNG Driver
26.8.1. Quick Start Guide for TRNG - Basic
26.8.1.1. Setup
26.8.1.1.1. Prerequisites
26.8.1.1.2. Code
26.8.1.1.3. Workflow
26.8.1.2. Implementation
26.8.1.2.1. Code
26.8.1.2.2. Workflow
26.8.2. Quick Start Guide for TRNG - Callback
26.8.2.1. Setup
26.8.2.1.1. Prerequisites
26.8.2.1.2. Code
26.8.2.1.3. Workflow
26.8.2.2. Implementation
26.8.2.2.1. Code
26.8.2.2.2. Workflow
27. SAM Watchdog Driver (WDT)
27.1. Prerequisites
27.2. Module Overview
27.2.1. Locked Mode
27.2.2. Window Mode
27.2.3. Early Warning
27.2.4. Physical Connection
27.3. Special Considerations
27.4. Extra Information
27.5. Examples
27.6. API Overview
27.6.1. Macro Definitions
27.6.1.1. Function Definitions
27.6.1.1.1. Type wdt_callback_t
27.6.2. Peripheral Lock and Unlock
27.6.2.1. Struct wdt_conf
27.6.3. APIs available for SAM L21/L22/C20/C21.
27.6.3.1. Driver Initialization and Configuration
27.6.3.1.1. Function wdt_is_syncing()
27.6.3.1.2. Function wdt_get_config_defaults()
27.6.3.1.3. Function wdt_set_config()
27.6.3.1.4. Function wdt_is_locked()
27.6.3.2. Enable/Disable
27.6.3.2.1. Function wdt_clear_early_warning()
27.6.3.2.2. Function wdt_is_early_warning()
27.6.3.2.3. Function wdt_reset_count()
27.6.3.3. Lock/Unlock
27.6.3.3.1. Function wdt_register_callback()
27.6.3.3.2. Function wdt_unregister_callback()
27.6.3.4. Ready to Write/Read
27.6.3.4.1. Function wdt_enable_callback()
27.6.3.4.2. Function wdt_disable_callback()
27.6.4. Read/Write
27.6.4.1. Callback Management
27.6.4.1.1. Enum wdt_callback
27.6.4.2. Enum wdt_period
27.7. Extra Information for WDT Driver
27.7.1. Acronyms
27.7.2. Dependencies
27.7.3. Errata
27.7.4. Module History
27.8. Examples for WDT Driver
27.8.1. Quick Start Guide for WDT - Basic
27.8.1.1. Setup
27.8.1.1.1. Prerequisites
27.8.1.1.2. Code
27.8.1.1.3. Workflow
27.8.1.2. Quick Start Guide for WDT - Basic
27.8.1.2.1. Code
27.8.1.2.2. Workflow
27.8.2. Quick Start Guide for WDT - Callback
27.8.2.1. Setup
27.8.2.1.1. Prerequisites
27.8.2.1.2. Code
27.8.2.1.3. Workflow
27.8.2.2. Quick Start Guide for WDT - Callback
27.8.2.2.1. Code
27.8.2.2.2. Workflow
28. SAM EEPROM Emulator Service (EEPROM)
28.1. Prerequisites
28.2. Module Overview
28.2.1. Implementation Details
28.2.1.1. Emulator Characteristics
28.2.1.2. Physical Memory
28.2.1.3. Master Row
28.2.1.4. Spare Row
28.2.1.5. Row Contents
28.2.1.6. Write Cache
28.2.2. Memory Layout
28.3. Special Considerations
28.3.1. NVM Controller Configuration
28.3.2. Logical EEPROM Page Size
28.3.3. Committing of the Write Cache
28.4. Extra Information
28.5. Examples
28.6. API Overview
28.6.1. Macro Definitions
28.6.1.1. Struct eeprom_emulator_parameters
28.6.2. Function Definitions
28.6.2.1. Peripheral Lock and Unlock
28.6.2.1.1. Macro EEPROM_EMULATOR_ID
28.6.2.1.2. Macro EEPROM_MAJOR_VERSION
28.6.2.1.3. Macro EEPROM_MINOR_VERSION
28.6.2.1.4. Macro EEPROM_REVISION
28.6.2.1.5. Macro EEPROM_PAGE_SIZE
28.6.3. APIs available for SAM L21/L22/C20/C21.
28.6.3.1. Driver Initialization and Configuration
28.6.3.1.1. Function eeprom_emulator_init()
28.6.3.1.2. Function eeprom_emulator_erase_memory()
28.6.3.1.3. Function eeprom_emulator_get_parameters()
28.6.3.2. Enable/Disable
28.6.3.2.1. Function eeprom_emulator_commit_page_buffer()
28.6.3.2.2. Function eeprom_emulator_write_page()
28.6.3.2.3. Function eeprom_emulator_read_page()
28.6.3.3. Lock/Unlock
28.6.3.3.1. Function eeprom_emulator_write_buffer()
28.6.3.3.2. Function eeprom_emulator_read_buffer()
28.7. Extra Information
28.7.1. Acronyms
28.7.2. Dependencies
28.7.3. Errata
28.7.4. Module History
28.8. Examples for Emulated EEPROM Service
28.8.1. Quick Start Guide for the Emulated EEPROM Module - Basic Use Case
28.8.1.1. Prerequisites
28.8.1.2. Setup
28.8.1.2.1. Prerequisites
28.8.1.2.2. Code
28.8.1.2.3. Workflow
28.8.1.3. Use Case
28.8.1.3.1. Code
28.8.1.3.2. Workflow
29. SAM Read While Write EEPROM (RWW EEPROM) Emulator Service
29.1. Prerequisites
29.2. Module Overview
29.2.1. Implementation Details
29.2.1.1. Emulator Characteristics
29.2.1.2. Physical Memory
29.2.1.3. Master Row
29.2.1.4. Spare Row
29.2.1.5. Row Contents
29.2.1.6. Write Cache
29.2.2. Memory Layout
29.3. Special Considerations
29.3.1. NVM Controller Configuration
29.3.2. Logical RWW EEPROM Page Size
29.3.3. Committing of the Write Cache
29.3.4. RWW EEPROM Page Checksum
29.4. Extra Information
29.5. Examples
29.6. API Overview
29.6.1. Macro Definitions
29.6.1.1. Struct rww_eeprom_emulator_parameters
29.6.2. Function Definitions
29.6.2.1. Peripheral Lock and Unlock
29.6.2.1.1. Macro RWW_EEPROM_EMULATOR_ID
29.6.2.1.2. Macro RWW_EEPROM_MAJOR_VERSION
29.6.2.1.3. Macro RWW_EEPROM_MINOR_VERSION
29.6.2.1.4. Macro RWW_EEPROM_REVISION
29.6.2.1.5. Macro RWW_EEPROM_PAGE_SIZE
29.6.3. APIs available for SAM L21/L22/C20/C21.
29.6.3.1. Driver Initialization and Configuration
29.6.3.1.1. Function rww_eeprom_emulator_init()
29.6.3.1.2. Function rww_eeprom_emulator_erase_memory()
29.6.3.1.3. Function rww_eeprom_emulator_get_parameters()
29.6.3.2. Enable/Disable
29.6.3.2.1. Function rww_eeprom_emulator_commit_page_buffer()
29.6.3.2.2. Function rww_eeprom_emulator_write_page()
29.6.3.2.3. Function rww_eeprom_emulator_read_page()
29.6.3.3. Lock/Unlock
29.6.3.3.1. Function rww_eeprom_emulator_write_buffer()
29.6.3.3.2. Function rww_eeprom_emulator_read_buffer()
29.6.4. Ready to Write/Read
29.6.4.1. Enum rwwee_logical_page_num_in_row
29.7. Extra Information
29.7.1. Acronyms
29.7.2. Dependencies
29.7.3. Errata
29.7.4. Module History
29.8. Examples for Emulated RWW EEPROM Service
29.8.1. Quick Start Guide for the Emulated RWW EEPROM Module - Basic Use Case
29.8.1.1. Setup
29.8.1.1.1. Prerequisites
29.8.1.1.2. Code
29.8.1.1.3. Workflow
29.8.1.2. Use Case
29.8.1.2.1. Code
29.8.1.2.2. Workflow
30. Document Revision History
31. Legal Disclaimer