This application note demonstrates how to use the Direct Memory Access (DMA) module of the EFM32.

Similar documents
The EFM32 I2C module allows simple, robust and cost effective communication between integrated circuits using only one data and one clock line.

Energy Micro University

EFM8 Universal Bee Family EFM8UB2 Errata

AN0059.1: UART Flow Control

AN999: WT32i Current Consumption

EFM32TG222 Errata History

QSG119: Wizard Gecko WSTK Quick-Start Guide

SMBus. Target Bootloader Firmware. Master Programmer Firmware. Figure 1. Firmware Update Setup

EFM32 Happy Gecko Family EFM32HG-SLSTK3400A Quick-Start Guide

Figure 1. Traditional Biasing and Termination for LVPECL Output Buffers

Date CET Initials Name Justification

EFM8 Busy Bee Family EFM8BB2-SLSTK2021A Quick Start Guide

AN0059.0: UART Flow Control

EFM32 Zero Gecko EFM32ZG Errata

EFM32 Pearl Gecko Family QSG118: EFM32PG1 SLSTK3401A Quick- Start Guide

UG345: Si72xx Eval Kit User's Guide

QSG144: CP2615-EK2 Quick-Start Guide

EFM32LG890 Errata, Chip Rev. E

Software Release Note

EFM8 Laser Bee Family QSG110: EFM8LB1-SLSTK2030A Quick Start Guide

EFR32 Mighty Gecko Family EFR32MG1 with Integrated Serial Flash Errata History

Translate HCSL to LVPECL, LVDS or CML levels Reduce Power Consumption Simplify BOM AVL. silabs.com Building a more connected world. Rev. 0.

AN1143: Using Micrium OS with Silicon Labs Thread

Humidity/Temp/Optical EVB UG

QSG107: SLWSTK6101A Quick-Start Guide

The process also requires the use of the following files found in the Micriµm Quick Start Package for the FRDM-KL46Z:

µc/probe on the Freescale FRDM-KL05Z without an RTOS

QSG123: CP2102N Evaluation Kit Quick- Start Guide

AN125 INTEGRATING RAISONANCE 8051 TOOLS INTO THE S ILICON LABS IDE. 4. Configure the Tool Chain Integration Dialog. 1. Introduction. 2.

EFR32MG13, EFR32BG13 & EFR32FG13 Revision C and Data Sheet Revision 1.0

QSG114: CPT007B SLEX8007A Kit Quick- Start Guide

Wireless Development Suite (WDS) is a software utility used to configure and test the Silicon Labs line of ISM band RFICs.

AN0885: EFM8UB Low Energy USB Overview

Router-E and Router-E-PA Wireless Router PRODUCT MANUAL

UG274: Isolated USB Expansion Board User Guide

Date CET Initials Name Justification

8-bit MCU Family C8051F93x/92x Errata

Figure 1. CP2108 USB-to-Quad UART Bridge Controller Evaluation Board

CP2110-EK CP2110 EVALUATION KIT USER S GUIDE. 1. Kit Contents. 2. Relevant Documentation. 3. Software Setup

AN1095: What to Do When the I2C Master Does Not Support Clock Stretching

CP2114 Family CP2114 Errata

EFM8 Busy Bee EFM8BB1 Errata

EFM8 Universal Bee Family EFM8UB1 Errata

AN976: CP2101/2/3/4/9 to CP2102N Porting Guide

EFM32 Pearl Gecko Family EFM32PG1 Errata

CP2104-EK CP2104 EVALUATION KIT USER S GUIDE. 1. Kit Contents. 2. Relevant Documentation. 3. Software Setup USBXpress Driver Development Kit

CP2103-EK CP2103 EVALUATION KIT USER S GUIDE. 1. Kit Contents. 2. Relevant Documentation. 3. Software Setup USBXpress Driver Development Kit

2. Key Points. F93x F92x F91x F90x. Figure 1. C8051F93x-C8051F90x MCU Family Memory Size Options

AN0018.1: Supply Voltage Monitoring

AN1139: CP2615 I/O Protocol

AN0018.0: Supply Voltage Monitoring

The Si50122-Ax-EVB is used to evaluate the Si50122-Ax. Table 1 shows the device part number and corresponding evaluation board part number.

CP2105-EK CP2105 EVALUATION KIT USER S GUIDE. 1. Kit Contents. 2. Relevant Documentation. 3. Software Setup USBXpress Driver Development Kit

AN1117: Migrating the Zigbee HA Profile to Zigbee 3.0

USB Debug Adapter. Power USB DEBUG ADAPTER. Silicon Laboratories. Stop. Run. Figure 1. Hardware Setup using a USB Debug Adapter

ADC Evaluation Platform GUI User s Guide

AN116. Power Management Techniques and Calculation. Introduction. Key Points. Power Saving Methods. Reducing System Clock Frequency

UG322: Isolated CAN Expansion Board User Guide

AN1106: Optimizing Jitter in 10G/40G Data Center Applications

UG294: CPT213B SLEXP8019A Kit User's Guide

Termination Options for Any-Frequency Si51x XOs, VCXOs

USBXpress Family CP2102N Errata

8-Bit MCU C8051F85x/86x Errata

UG271: CP2615-EK2 User's Guide

WT12 EVALUATION KIT DATA SHEET. Monday, 09 September Version 1.7

AN324 ADVANCED ENCRYPTION STANDARD RELEVANT DEVICES. 1. Introduction. 2. Implementation Potential Applications Firmware Organization

UG254: CP2102N-MINIEK Kit User's Guide

Figure 1. Precision32 AppBuilder

Bluegiga WF111 Software Driver Release Notes

EFM32G Product Revision E

BRD4300B Reference Manual MGM111 Mighty Gecko Module

AN1160: Project Collaboration with Simplicity Studio

QSG159: EFM32TG11-SLSTK3301A Quick- Start Guide

UG365: GATT Configurator User s Guide

μc/probe on the RIoTboard (Linux)

UG103.7: Tokens Fundamentals

Software Design Specification

Table 1. Kits Content. Qty Part Number Description. Si4010 Simplified Key Fob Demo Kit 868 MHz

UG313: Thunderboard Sense 2 Bluetooth Low Energy Demo User's Guide

SiM3xxxx Address Space (RAM) Figure 1. Transferring Data using the DMA and DTM modules

TS9004 Demo Board FEATURES ORDERING INFORMATION

AN690. Si4010 DEVELOPMENT KIT QUICK-START GUIDE. 1. Purpose. 2. Kit Content. Table 1. Kit Content

QSG155: Using the Silicon Labs Dynamic Multiprotocol Demonstration Applications

QSG126: Bluetooth Developer Studio Quick-Start Guide

μc/probe on the element14 BeagleBone Black

Software Design Specification

ETRX3DVK Development Kit Quick-Start Guide

Not Recommended for New Designs. Si Data Sheet Errata for Product Revision B

FM-DAB-DAB Seamless Linking I2S SRAM. I2C / SPI Host Interface. FLASH Interface MOSI/SDA INTB MISO/A0 RSTB SCLK/SCL SSB/A1 SMODE

USB Debug Adapter. Power USB DEBUG ADAPTER. Silicon Laboratories. Stop. Run. Figure 1. Hardware Setup Using a USB Debug Adapter

Si1146 UVIRSlider2EK Demo Kit

Date CET Initials Name Justification

TS7001 Demo Board. A Micropower, 2-channel, ksps, Serial-Output 12-bit SAR ADC FEATURES

UG366: Bluetooth Mesh Node Configuration User s Guide

Figure 1. Proper Method of Holding the ToolStick. Figure 2. Improper Method of Holding the ToolStick

AN1023: HTTP SERVER EXAMPLE

USB Debug Adapter. Power USB DEBUG ADAPTER. Silicon Laboratories. Stop. Run. Figure 1. Hardware Setup Using a USB Debug Adapter

AN888: EZR32 Quick Start Guide

EFM32 Series 0: DMA (ARM PrimeCell µdma PL230)

AN1083: Creating and Using a Secure CoAP Connection with ARM s mbed TLS

Transcription:

Direct Memory Access AN0013 - Application Note Introduction This application note demonstrates how to use the Direct Memory Access (DMA) module of the EFM32. Memory to memory, peripheral to memory, ping-pong and scatter-gather modes are used in the attached software example. This application note includes: This PDF document Source files (zip) Example C-code Multiple IDE projects

1 DMA Theory 1.1 General DMA is used for data transfer without CPU intervention. Data can be transferred between any locations within the EFM32 address space and additionally several peripherals have DMA support. This means that each time new data is to be read or written, the DMA can be triggered to perform a new transfer. The DMA makes the CPU available for other tasks rather than data transfer, or the CPU can enter energy mode 1 (EM1) in order to save energy while data is transferred. Upon completion the DMA can wake up the CPU using interrupt. 1.2 DMA Channels The EFM32 features 8 DMA channels which may be individually configured. For example, channel 0 may be used to move data received by the I2C to ram, channel 2 may move conversion data from the ADC to ram, while channel 3 transfers data from flash to the EBI etc... For a complete list of peripherals capable of generating DMA triggers please refer to the DMA section in the reference manual. 1.3 Setup For each DMA channel the source/destination address, transfer length and other parameters must be specified. The details are described in the subsequent chapter. 2011-01-03 - an0013_rev1.02 2 www.energymicro.com

2 DMA Channel Configuration 2.1 Transfer Setup In order for a DMA transaction to take place, several parameters such as source/destination address and transfer length must be specified. The configuration is partly stored in a descriptor stored in RAM. The location of this descriptor must be aligned to a 256 byte-location, i.e. the lower 8 bits of its address must be 0. Please refer to the attached software example for details on how to align the structure. 2.1.1 Source/Destination Address, Size, Length and Increment The core parameters of the DMA transfer are the source and destination addresses which specifies from which location the data is to be fetched and to where it is to be transferred. The size parameter specifies the size of the transfer unit, i.e 1, 2 or 4 bytes. Additionally, the number of such unit transfers the DMA is to perform (length) must be set. The increment is set individually for both the source and destination address, and indicates whether the address is to be incremented after transferring each unit, and if so, by how much. E.g. when transferring RX data from the USART, the source address is not to be incremented, as the data is read from the same location each time. The destination address, however, must be incremented (e.g. by 1 byte). The transfer size would in this case also be 1 byte. 2.1.2 Transfer Mode The DMA can operate in several different modes as specified in Table 2.1 (p. 3). Table 2.1. DMA Transfer Modes Mode Basic Auto Ping-Pong Scatter- Gather Description This mode is generally used when transferring data to or from a peripheral. The peripheral asserts a DMA trigger each time new data is available or needed, and in response the DMA performs one unit transfer (e.g. transfers one byte to the USART_TXDATA register). Such unit transfers will be repeated until the number of transfers equals the specified transfer length. This mode is used when both the source and destination location is ready to transfer all the data, e.g. when transferring data from flash to ram. Once the transfer is started, the number of transfers specified by the transfer length is performed without waiting for any further triggers. Each Channel has one primary and one alternate structure. In pong-pong mode, the DMA first uses the primary descriptor and then switches to the alternate structure. This mode is useful when it is required that there is an active DMA at all times, e.g. when fetching data from the ADC running at 1Msampe/s. In this mode the primary DMA descriptor is used to load the alternate DMA descriptor. The DMA will first load the alternate structure and then perform the transfer specified by the alternate structure before loading a new alternate structure which is subsequently executed. In this manner a sequence of transactions can be specified and performed without any run-time intervention by the CPU. For further details on the modes please refer to the DMA section in the reference manual. 2.1.3 DMA Trigger When transferring data to or from a peripheral unit, the DMA trigger signal from the peripheral must be specified for the DMA channel to be used. For example, the following code configures DMA channel 0 to use USART0 TX as trigger: DMA->CH[0].CTRL = DMAREQ_USART0_TXBL 2.1.4 DMA Interrupt After a DMA channel has performed the "length" transfers, the DMA channel is done. Upon completion, the DMA channel may generate an interrupt request. If desired the DMA channel can be re-enabled within the DMA interrupt routine. 2011-01-03 - an0013_rev1.02 3 www.energymicro.com

Note The DMA controller maintains some of its variables such as transfer length in the DMA descriptor structure in RAM. When re-enabling the DMA, the transfer-length must be set to its correct value. 2.1.5 DMA Priority Since the CPU and the different DMA channels operate on the same bus structure, contention is likely to occur. There are two ways to prioritize a DMA channel. Firstly, the DMA channel number sets a priority in that channel 0 has the highest priority and channel 7 has the lowest. Additionally, it is possible to set the channel priority to high. A channel with high priority is prioritized over any channels with normal priority. The channel 0 will get the highest possible priority if its priority is set to high. For further details on the DMA controller and different settings please refer to the included software and the reference manual. 2.1.6 Further Info For further details on the DMA controller and different settings please refer to the included software and the reference manual. 2011-01-03 - an0013_rev1.02 4 www.energymicro.com

3 Software Example 3.1 General The attached software example demonstrates how to use the DMA in different modes. In the sections below more details about each example-stage are given. While waiting for a DMA channel to complete, Sleep Mode (EM1) is entered in order to save energy. 3.1.1 Flash Transfer The first example illustrates how to use the DMA to transfer data between to memory locations. A set of data located in flash is transferred to RAM using the DMA. In this transfer, the Auto setting is used, which makes the DMA transfer the whole buffer once it has started. Upon completion the call-back function is called. 3.1.2 ADC Transfer This example demonstrates how to use the DMA to transfer data from a peripheral to RAM. The DMA channel is set up to use the Basic mode, which makes the DMA transfer one unit each time the peripheral (i.e. the ADC in this example) sets its DMA trigger. When the specified number of units have been transferred, the corresponding call-back function is called. 3.1.3 ADC Transfer (Ping-Pong) This example is differs from the previous one in that the DMA uses Ping-Pong mode. The transfer is re-enabled a number of times in order to demonstrate how to refresh the DMA. After both the primary and the alternate DMA structure has been utilized a defined number of times, the example stage is terminated by not updating the DMA structures. 3.1.4 Scatter-Gather Transfer In this example a sequence of 3 transfers is executed using the Scatter-Gather mode. The primary structure is used to sequentially load the alternate structure with the 3 core transfers to be performed. When the third transfer is completed, the call-back function is called and the example is terminated by entering an eternal while-loop. 2011-01-03 - an0013_rev1.02 5 www.energymicro.com

4 Revision History 4.1 Revision 1.02 January 03th, 2011. Changed some incorrect function descriptions in dmaexample.c. 4.2 Revision 1.01 November 16th, 2010. Changed example folder structure, removed build and src folders. Added chip-init function. 4.3 Revision 1.00 September 20th, 2010. Initial revision. 2011-01-03 - an0013_rev1.02 6 www.energymicro.com

A Disclaimer and Trademarks A.1 Disclaimer Energy Micro AS intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers using or intending to use the Energy Micro products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific device, and "Typical" parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Energy Micro reserves the right to make changes without further notice and limitation to product information, specifications, and descriptions herein, and does not give warranties as to the accuracy or completeness of the included information. Energy Micro shall have no liability for the consequences of use of the information supplied herein. This document does not imply or express copyright licenses granted hereunder to design or fabricate any integrated circuits. The products must not be used within any Life Support System without the specific written consent of Energy Micro. A "Life Support System" is any product or system intended to support or sustain life and/or health, which, if it fails, can be reasonably expected to result in significant personal injury or death. Energy Micro products are generally not intended for military applications. Energy Micro products shall under no circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering such weapons. A.2 Trademark Information Energy Micro, EFM32, EFR, logo and combinations thereof, and others are the registered trademarks or trademarks of Energy Micro AS. ARM, CORTEX, THUMB are the registered trademarks of ARM Limited. Other terms and product names may be trademarks of others. 2011-01-03 - an0013_rev1.02 7 www.energymicro.com

B Contact Information B.1 Energy Micro Corporate Headquarters Postal Address Visitor Address Technical Support Energy Micro AS P.O. Box 4633 Nydalen N-0405 Oslo NORWAY www.energymicro.com Phone: +47 23 00 98 00 Fax: + 47 23 00 98 01 B.2 Global Contacts Energy Micro AS Sandakerveien 118 N-0405 Oslo NORWAY support.energymicro.com Phone: +47 40 10 03 01 Visit www.energymicro.com for information on global distributors and representatives or contact sales@energymicro.com for additional information. Americas Europe, Middle East and Africa Asia and Pacific www.energymicro.com/americas www.energymicro.com/emea www.energymicro.com/asia 2011-01-03 - an0013_rev1.02 8 www.energymicro.com

Table of Contents 1. DMA Theory... 2 1.1. General... 2 1.2. DMA Channels... 2 1.3. Setup... 2 2. DMA Channel Configuration... 3 2.1. Transfer Setup... 3 3. Software Example... 5 3.1. General... 5 4. Revision History... 6 4.1. Revision 1.02... 6 4.2. Revision 1.01... 6 4.3. Revision 1.00... 6 A. Disclaimer and Trademarks... 7 A.1. Disclaimer... 7 A.2. Trademark Information... 7 B. Contact Information... 8 B.1. Energy Micro Corporate Headquarters... 8 B.2. Global Contacts... 8 2011-01-03 - an0013_rev1.02 9 www.energymicro.com

List of Tables 2.1. DMA Transfer Modes... 3 2011-01-03 - an0013_rev1.02 10 www.energymicro.com