Microchip ATSAMD21G16 Handleiding


Lees hieronder de 📖 handleiding in het Nederlandse voor Microchip ATSAMD21G16 (44 pagina's) in de categorie Niet gecategoriseerd. Deze handleiding was nuttig voor 216 personen en werd door 2 gebruikers gemiddeld met 4.5 sterren beoordeeld

Pagina 1/44
42258A-SAMD21-04/2014
APPLICATION NOTE
AT07627: ASF Manual (SAM D21)
ASF PROGRAMMERS MANUAL
Preface
The Atmel® Software Framework (ASF) is a collection of free embedded software for
Atmel microcontroller devices. It simplifies the usage of Atmel products, providing an
abstraction to the hardware and high-value middleware.
ASF is designed to be used for evaluation, prototyping, design and production
phases. ASF is integrated in the Atmel Studio IDE with a graphical user interface
or available as a standalone package for several commercial and open source
compilers.
This document describes the API interfaces to the low level ASF module drivers of
the device.
For more information on ASF please refer to the online documentation at
www.atmel.com/asf.
AT07627: ASF Manual (SAM D21) [APPLICATION NOTE]
42258A-SAMD21-04/2014
2
Table of Contents
Preface ................................................................................................ 1
Software License .............................................................................. 13
1. SAM D20/D21 Analog Comparator Driver (AC) ......................... 14
1.1. Prerequisites ............................................................................ 14
1.2. Module Overview ...................................................................... 14
1.2.1. Window Comparators and Comparator Pairs ...................... 14
1.2.2. Positive and Negative Input MUXs ................................... 14
1.2.3. Output Filtering ............................................................. 15
1.2.4. Input Hysteresis ............................................................ 15
1.2.5. Single Shot and Continuous Sampling Modes ..................... 15
1.2.6. Events ........................................................................ 15
1.2.7. Physical Connection ...................................................... 15
1.3. Special Considerations ............................................................... 16
1.4. Extra Information ....................................................................... 16
1.5. Examples ................................................................................. 16
1.6. API Overview ........................................................................... 16
1.6.1. Variable and Type Definitions .......................................... 16
1.6.2. Structure Definitions ...................................................... 17
1.6.3. Macro Definitions .......................................................... 18
1.6.4. Function Definitions ....................................................... 20
1.6.5. Enumeration Definitions .................................................. 29
1.7. Extra Information for AC Driver .................................................... 32
1.7.1. Acronyms .................................................................... 32
1.7.2. Dependencies .............................................................. 33
1.7.3. Errata ......................................................................... 33
1.7.4. Module History ............................................................. 33
1.8. Examples for AC Driver .............................................................. 33
1.8.1. Quick Start Guide for AC - Basic ...................................... 33
1.8.2. Quick Start Guide for AC - Callback ................................. 37
2. SAM D20/D21 Analog to Digital Converter Driver (ADC) ........... 43
2.1. Prerequisites ............................................................................ 43
2.2. Module Overview ...................................................................... 43
2.2.1. Sample Clock Prescaler ................................................. 44
2.2.2. ADC Resolution ............................................................ 44
2.2.3. Conversion Modes ........................................................ 44
2.2.4. Differential and Single-Ended Conversion .......................... 44
2.2.5. Sample Time ................................................................ 44
2.2.6. Averaging .................................................................... 45
2.2.7. Offset and Gain Correction ............................................. 45
2.2.8. Pin Scan ..................................................................... 46
2.2.9. Window Monitor ............................................................ 46
2.2.10. Events ........................................................................ 46
2.3. Special Considerations ............................................................... 46
2.4. Extra Information ....................................................................... 46
2.5. Examples ................................................................................. 47
2.6. API Overview ........................................................................... 47
2.6.1. Variable and Type Definitions .......................................... 47
2.6.2. Structure Definitions ...................................................... 47
2.6.3. Macro Definitions .......................................................... 49
2.6.4. Function Definitions ....................................................... 50
2.6.5. Enumeration Definitions .................................................. 62
2.7. Extra Information for ADC Driver .................................................. 67
2.7.1. Acronyms .................................................................... 67
2.7.2. Dependencies .............................................................. 67
AT07627: ASF Manual (SAM D21) [APPLICATION NOTE]
42258A-SAMD21-04/2014
3
2.7.3. Errata ......................................................................... 67
2.7.4. Module History ............................................................. 67
2.8. Examples for ADC Driver ............................................................ 67
2.8.1. Quick Start Guide for ADC - Basic ................................... 67
2.8.2. Quick Start Guide for ADC - Callback ............................... 70
2.8.3. Quick Start Guide for Using DMA with ADC/DAC ................. 73
3. SAM D20/D21 Brown Out Detector Driver (BOD) ...................... 81
3.1. Prerequisites ............................................................................ 81
3.2. Module Overview ...................................................................... 81
3.3. Special Considerations ............................................................... 81
3.4. Extra Information ....................................................................... 81
3.5. Examples ................................................................................. 81
3.6. API Overview ........................................................................... 81
3.6.1. Structure Definitions ...................................................... 81
3.6.2. Function Definitions ....................................................... 82
3.6.3. Enumeration Definitions .................................................. 85
3.7. Extra Information for BOD Driver .................................................. 86
3.7.1. Acronyms .................................................................... 86
3.7.2. Dependencies .............................................................. 86
3.7.3. Errata ......................................................................... 86
3.7.4. Module History ............................................................. 86
3.8. Examples for BOD Driver ........................................................... 86
3.8.1. Quick Start Guide for BOD - Basic ................................... 86
3.8.2. Application Use Case for BOD - Application ....................... 88
4. SAM D20/D21 Digital-to-Analog Driver (DAC) ........................... 89
4.1. Prerequisites ............................................................................ 89
4.2. Module Overview ...................................................................... 89
4.2.1. Conversion Range ........................................................ 90
4.2.2. Conversion .................................................................. 90
4.2.3. Analog Output .............................................................. 90
4.2.4. Events ........................................................................ 91
4.2.5. Left and Right Adjusted Values ........................................ 91
4.2.6. Clock Sources .............................................................. 91
4.3. Special Considerations ............................................................... 91
4.3.1. Output Driver ............................................................... 91
4.3.2. Conversion Time ........................................................... 91
4.4. Extra Information ....................................................................... 92
4.5. Examples ................................................................................. 92
4.6. API Overview ........................................................................... 92
4.6.1. Variable and Type Definitions .......................................... 92
4.6.2. Structure Definitions ...................................................... 92
4.6.3. Macro Definitions .......................................................... 93
4.6.4. Function Definitions ....................................................... 93
4.6.5. Enumeration Definitions ................................................ 106
4.7. Extra Information for DAC Driver ................................................ 107
4.7.1. Acronyms ................................................................... 107
4.7.2. Dependencies ............................................................. 108
4.7.3. Errata ........................................................................ 108
4.7.4. Module History ............................................................ 108
4.8. Examples for DAC Driver .......................................................... 108
4.8.1. Quick Start Guide for DAC - Basic .................................. 108
4.8.2. Quick Start Guide for DAC - Callback .............................. 111
4.8.3. Quick Start Guide for Using DMA with ADC/DAC ............... 117
5. SAM D20/D21 EEPROM Emulator Service (EEPROM) ........... 118
5.1. Prerequisites ........................................................................... 118
5.2. Module Overview ..................................................................... 118
5.2.1. Implementation Details ................................................. 118
5.2.2. Memory Layout ........................................................... 120
AT07627: ASF Manual (SAM D21) [APPLICATION NOTE]
42258A-SAMD21-04/2014
6
9.7. Extra Information for NVM Driver ................................................ 241
9.7.1. Acronyms ................................................................... 241
9.7.2. Dependencies ............................................................. 241
9.7.3. Errata ........................................................................ 241
9.7.4. Module History ............................................................ 241
9.8. Examples for NVM Driver .......................................................... 242
9.8.1. Quick Start Guide for NVM - Basic ................................. 242
10. SAM D20/D21 Peripheral Access Controller Driver (PAC) ....... 245
10.1. Prerequisites ........................................................................... 245
10.2. Module Overview ..................................................................... 245
10.2.1. Locking Scheme ......................................................... 245
10.2.2. Recommended Implementation ...................................... 245
10.2.3. Why Disable Interrupts ................................................. 246
10.2.4. Run-away Code .......................................................... 247
10.2.5. Faulty Module Pointer .................................................. 249
10.2.6. Use of __no_inline ....................................................... 249
10.2.7. Physical Connection ..................................................... 249
10.3. Special Considerations ............................................................. 250
10.3.1. Non-Writable Registers ................................................. 250
10.3.2. Reading Lock State ..................................................... 250
10.4. Extra Information ..................................................................... 251
10.5. Examples ............................................................................... 251
10.6. API Overview .......................................................................... 251
10.6.1. Macro Definitions ........................................................ 251
10.6.2. Function Definitions ..................................................... 251
10.7. List of Non-Write Protected Registers .......................................... 253
10.8. Extra Information for PAC Driver ................................................. 254
10.8.1. Acronyms ................................................................... 254
10.8.2. Dependencies ............................................................. 254
10.8.3. Errata ........................................................................ 254
10.8.4. Module History ............................................................ 254
10.9. Examples for PAC Driver .......................................................... 254
10.9.1. Quick Start Guide for PAC - Basic .................................. 254
11. SAM D20/D21 Port Driver (PORT) ........................................... 258
11.1. Prerequisites ........................................................................... 258
11.2. Module Overview ..................................................................... 258
11.2.1. Physical and Logical GPIO Pins ..................................... 258
11.2.2. Physical Connection ..................................................... 258
11.3. Special Considerations ............................................................. 259
11.4. Extra Information ..................................................................... 259
11.5. Examples ............................................................................... 259
11.6. API Overview .......................................................................... 259
11.6.1. Structure Definitions ..................................................... 259
11.6.2. Macro Definitions ........................................................ 260
11.6.3. Function Definitions ..................................................... 260
11.6.4. Enumeration Definitions ................................................ 265
11.7. Extra Information for PORT Driver .............................................. 265
11.7.1. Acronyms ................................................................... 265
11.7.2. Dependencies ............................................................. 265
11.7.3. Errata ........................................................................ 265
11.7.4. Module History ............................................................ 266
11.8. Examples for PORT Driver ........................................................ 266
11.8.1. Quick Start Guide for PORT - Basic ................................ 266
12. SAM D20/D21 RTC Calendar Driver (RTC CAL) ..................... 269
12.1. Prerequisites ........................................................................... 269
12.2. Module Overview ..................................................................... 269
12.2.1. Alarms and Overflow .................................................... 269
12.2.2. Periodic Events ........................................................... 270
AT07627: ASF Manual (SAM D21) [APPLICATION NOTE]
42258A-SAMD21-04/2014
17
1.6.2 Structure Definitions
1.6.2.1 Struct ac_chan_config
Configuration structure for a Comparator channel, to configure the input and output settings of the comparator.
Table 1-1. Members
Type Name Description
bool enable_hysteresis When true, hysteresis mode is
enabled on the comparator inputs.
enum filter Filtering mode for the comparatorac_chan_filter
output, when the comparator is
used in a supported mode.
enum interrupt_selection Interrupt criteria for the comparatorac_chan_interrupt_selection
channel, to select the condition that
will trigger a callback.
enum negative_input Input multiplexer selection for theac_chan_neg_mux
comparator's negative input pin.
enum output_mode Output mode of the comparator,ac_chan_output
whether it should be available for
internal use, or asynchronously/
synchronously linked to a GPIO
pin.
enum positive_input Input multiplexer selection for theac_chan_pos_mux
comparator's positive input pin.
enum sample_mode Sampling mode of the comparatorac_chan_sample_mode
channel.
uint8_t vcc_scale_factor Scaled VCC voltage division
factor for the channel, when a
comparator pin is connected to
the VCC voltage scalar input.
The formular is: Vscale = Vdd *
vcc_scale_factor / 64. If the VCC
voltage scalar is not selected as a
comparator channel pin's input, this
value will be ignored.
1.6.2.2 Struct ac_config
Configuration structure for a Comparator channel, to configure the input and output settings of the comparator.
Table 1-2. Members
Type Name Description
bool run_in_standby[] If true, the comparator pairs will
continue to sample during sleep
mode when triggered.
enum source_generator Source generator for AC GCLK.gclk_generator
1.6.2.3 Struct ac_events
Event flags for the Analog Comparator module. This is used to enable and disable events via ac_enable_events()
and .ac_disable_events()


Product specificaties

Merk: Microchip
Categorie: Niet gecategoriseerd
Model: ATSAMD21G16

Heb je hulp nodig?

Als je hulp nodig hebt met Microchip ATSAMD21G16 stel dan hieronder een vraag en andere gebruikers zullen je antwoorden




Handleiding Niet gecategoriseerd Microchip

Handleiding Niet gecategoriseerd

Nieuwste handleidingen voor Niet gecategoriseerd