Psoc 3 and Psoc 5Lp - Getting Started With Dma
Psoc 3 and Psoc 5Lp - Getting Started With Dma
Psoc 3 and Psoc 5Lp - Getting Started With Dma
Contents
1 Introduction ..................................................................1 10.1 Example 5 DMA Configuration .......................... 17
2 Basic Concepts of DMA ...............................................2 10.2 Example 5 Project Files .................................... 17
3 DMA Configuration ......................................................3 11 Summary ................................................................... 18
3.1 Channel Configuration ........................................3 12 About the Author ....................................................... 18
3.2 TD Configuration .................................................4 Appendix A. DMA Configuration Steps ..................... 19
4 DMA component overview ...........................................5 A.1 Other Important DMA API Functions ................ 21
4.1 Hardware Connections of DMA component ........5 Appendix B. DMA Wizard Configuration ................... 22
5 Firmware Configuration of DMA ..................................6 Appendix C. Setting DMA Channel Priority ............... 25
6 Example 1: Peripheral-to-Peripheral Transfer .............7 Appendix D. Example Projects – Test Setup ............. 26
6.1 Example 1 DMA Configuration ............................8 D.1 Example 1: Peripheral-to-Peripheral
6.2 Example 1 Project Files ......................................8 Transfer – Eg1_ADC_DMA_DAC ..................... 26
6.3 Example 1 DMA Configuration Code ..................9 D.2 Example 2: Peripheral-to-Memory
7 Example 2: Peripheral-to-Memory Transfer ............... 10 Transfer – Eg2_ADC_DMA_Mem ..................... 26
7.1 Example 2 DMA Configuration .......................... 11 D.3 Example 3: Memory-to-Peripheral
Transfer – Eg3_Mem_DMA_DAC ..................... 27
7.2 Example 2 Project Files .................................... 12
D.4 Example 4: Memory-to-Memory
8 Example 3: Memory-to-Peripheral Transfer ............... 12 Transfer – Eg4_Mem_DMA_Mem .................... 27
8.1 Example 3 DMA Configuration .......................... 13 D.5 Example 5: TD Chaining–
8.2 Example 3 Project Files .................................... 14 Eg5_TD_Chaining............................................. 28
9 Example 4: Memory-to-Memory Transfer .................. 14 Appendix E. Frequently Asked Questions ................. 30
9.1 Example 4 DMA Configuration .......................... 15 Worldwide Sales and Design Support ............................. 32
9.2 Example 4 Project Files .................................... 16
10 Example 5: TD Chaining ............................................ 16
1 Introduction
The DMA controller (DMAC) in PSoC 3 and PSoC 5LP can transfer data from a source to a destination with no CPU
intervention. This allows the CPU to handle other tasks while the DMA does data transfers, thereby achieving a
‘multiprocessing’ environment.
The PSoC DMA Controller (DMAC) is highly flexible – it can seamlessly transfer data between memory and on chip
peripherals including ADCs, DACs, Filter, USB, UART, and SPI. There are 24 independent DMA channels.
This application note describes how to configure the DMA for simple data transfers. It includes projects that show
several different types of DMA transfers:
▪ Peripheral-to-Memory
▪ Memory-to-Peripheral
▪ Peripheral-to-Peripheral
▪ Memory-to-Memory
This application note assumes that you are familiar with developing applications using PSoC Creator for PSoC 3 or
PSoC 5LP. If you are new to PSoC 3 or PSoC 5LP, introductions can be found in AN54181, Getting Started with
PSoC 3 and AN77759, Getting Started with PSoC 5. Advanced DMA topics are documented in AN84810. If you are
new to PSoC Creator, see the PSoC Creator home page.
CPU
Spoke 2
Spoke 4
Spoke 6
Spoke 0
Spoke
Arbitration
PHUB
Spoke 1
Spoke 3
Spoke 5
Spoke 7
The PHUB has eight data buses that are called spokes. Each spoke connects the CPU and DMAC to one or more
peripherals. Spokes can have widths of either 16 bits or 32 bits. Peripherals attached to a spoke can have widths of 8
bits, 16 bits, or 32 bits.
The data width of a peripheral is usually less than or equal to the data width of the spoke to which it is attached. If a
peripheral data width is greater than that of the spoke attached to it, the PHUB can transact with the peripheral at the
width of the spoke.
The PHUB has two bus masters, the CPU and the DMAC. The CPU and the DMAC can access different PHUB spokes
at the same time. If the CPU and DMAC try to access the same spoke at the same time, bus arbitration occurs. See
the PSoC 3 and PSoC 5LP Technical Reference Manuals for details.
Each of the 24 DMA channels can independently transfer data. Each channel has a Transaction Descriptor (TD) chain,
as Figure 2 shows. The TD contains information such as source address, destination address, transfer count, and the
next TD in the chain. There can be as many as 128 TDs. The combination of channel and TD describes the complete
DMA transfer.
DMA Channel
TD0 TD1
Transfer Transfer
Source Destination Next TD Source Destination Next TD
Count Count
Each DMA channel has a separate DMA request input that initiates a transaction. A DMA request can be initiated by
the CPU or by a peripheral. When a DMA request is received, the DMAC accesses the spokes attached to the source
and destination and moves data as configured in the channel and the associated TD.
3 DMA Configuration
A DMA transfer is configured using channel and TD configuration registers. Figure 3 shows the channel and the TD
configuration parameters.
Figure 3. DMA Configuration
Channel TD
Configuration Configuration
Source Address Source Address
(Upper 16 bits) (Lower 16 bits)
Preserve TD
(TRUE or FALSE)
3.2 TD Configuration
TD configuration parameters are explained below:
Property Description
Increment Source Address If this bit is set, the source address is incremented as the DMA transaction proceeds.
Increment Destination Address If this bit is set, the destination address is incremented as the DMA transaction proceeds
Swap Enable If set, DMA swaps the data bytes while it moves data from the source to destination.
Swap Size Defines the size of the swap performed, if Swap Enable is set.
0: Every 2 bytes are endian swapped during the DMA transfer.
1: Every 4 bytes are endian swapped during the DMA transfer
Auto Execute Next TD 0: The next TD in the chain is executed only after the next DMA request.
1: The next TD in the chain is automatically executed after the current TD transfer is finished.
DMA Completion Event If set, generates a DMA “done signal” after the data transfer is finished. This is typically used
to create an interrupt after the transfer is finished.
Enable TD termination If set, the ongoing transaction can be terminated using hardware signal
The PSoC 3 Keil Compiler uses big endian format to store 16-bit and 32-bit variables. But the PSoC 3 peripheral
registers use little endian format. For this reason, the DMA must be configured to swap bytes when it moves multi-byte
data between the peripheral registers and memory in PSoC 3. This is not required for PSoC 5LP as both peripherals
and memory uses the same endian format.
Now let us see how to configure the DMA using PSoC Creator.
Optional
Terminals
The DMA channel component and an associated API are used to configure the DMA to transfer data.
Hardware Request (drq): This setting defines the type of signal (rising edge/level) used to trigger the DMA channel.
Any selection for this parameter except "Disabled" adds a drq terminal to the component. The drq can be connected to
any hardware signal, to trigger the DMA channel.
Without the drq terminal, the DMA transaction is triggered only by the CPU.
When this parameter is set to “derived”, the DMA trigger type - edge/level is determined from the source of the DMA
trigger. For more information, see the DMA component datasheet.
Hardware Termination (trq): When this option is set to true, another input terminal (trq) is displayed in the component.
If TD termination is enabled, a rising edge on this terminal stops an ongoing DMA transaction. Note that trq terminates
a TD chain only if there is an ongoing DMA burst transaction. Refer to the component datasheet for more details.
Transfer complete (nrq): In order to indicate that the DMA transfer is finished, the TD can be configured to create a
pulse of width 2 bus clocks at the NRQ terminal of the DMA channel, when the transfer is finished. The nrq terminal
can be connected to an interrupt, or to another component for further actions.
Set the TD properties to define whether or not to generate a signal on the nrq terminal, and whether or not to enable
TD termination using trq.
The above firmware steps are detailed in DMA Configuration Steps on page 19. A DMA wizard can be used to
automatically generate the code to configure the DMA channel; see DMA Wizard Configuration on page 22 for more
details.
Note that the DMA wizard supports DMA transactions between only a limited set of PSoC peripherals. If the DMA
wizard does not support a peripheral, you must manually configure the DMA channel using the functions detailed in
Appendix A.
Following are a set of four examples that show in detail how to do DMA transfers between memory and peripherals. A
fifth example shows how to build a multiple-TD chain.
EoC
DMA DMA
Request Done
(DRQ) (NRQ)
TD
Pointer
TD[0]
Transfer
Source Destination Next TD
Count
TD Property: None
As Figure 7 shows, the ADC is configured in 8-bit, single-ended mode to match the data format of the VDAC, which is
a single-ended 8-bit voltage DAC. The hardware request (DRQ) of the DMA channel is enabled and connected to the
ADC EoC signal so that ADC can make a request for data transfers whenever an ADC result is available.
After it receives the request, the DMA channel reads one byte of data from the ADC output register and writes to the
DAC data register.
Figure 7. Top Design, Peripheral-to-Peripheral Transfer
The channel configuration has the upper 16 bits of the 32-bit address for both the source and destination addresses.
CYDEV_PERIPH_BASE, defined in the PSoC Creator auto-generated file cydevice.h, defines the base address of all
PSoC peripherals including the ADC and the DAC.
HI16 is a PSoC Creator macro that returns the upper 16 bits of a 32-bit value. This macro is used to get the upper 16
bits of the source and destination address.
As an alternative, you can assign the upper source and destination addresses relative to the component registers, as
Table 3 shows. The address definitions can be found in the component files ADC_DelSig.h, and VDAC8.h, respectively.
Table 3. Alternative Upper Addresses
The TDs can be viewed as an array of chained TDs; in this case we need only a one-element array TD[0].
Table 4. TD[0] Configuration Settings
/* Step 1 */
/* DMA Initializations done for both the DMA Channels
* Burst count = 1, (8 bit data transferred to VDAC one at a time)
* Request per burst = 1 (transfer burst only on new request)
* High byte of source address = Upper 16 bits of ADC data register
* High byte of destination address = Upper bytes of the VDAC8 data register
* DMA_Chan holds the channel handle returned by the ‘DmaInitialize’ function. This is
* used for all further references of the channel */
DMA_Chan = DMA_DmaInitialize(DMA_BYTES_PER_BURST, DMA_REQUEST_PER_BURST,
HI16(DMA_SRC_BASE), HI16(DMA_DST_BASE));
/* Step 2 */
/* Allocate TD for DMA Channel
* DMA_TD[0] is a variable that holds the TD handle returned by the TD allocate
function.
* This is used for all further references of the TD */
DMA_TD[0] = CyDmaTdAllocate();
/* Step 3 */
/* Configure TD[0]
* Transfer count = 1 (total number of bytes to transfer from the ADC to DAC)
* Next Td = DMA_TD[0]. The same td has to repeat itself for every ADC EoC.
* Configuration = No special TD configurations required */
CyDmaTdSetConfiguration(DMA_TD[0], 1, DMA_TD[0], 0);
/* Step 4 */
/* Configure the td address
* Source address = Lower 16 bits of ADC data register
* Destination address = Lower 16 bits of VDAC8 data register */
CyDmaTdSetAddress(DMA_TD[0], LO16((uint32)ADC_DelSig_DEC_SAMP_PTR),
LO16((uint32)VDAC8_Data_PTR));
/* Step 5 */
/* Map the TD to the DMA Channel */
CyDmaChSetInitialTd(DMA_Chan, DMA_TD[0]);
/* Step 6 */
/* Enable the channel
* The Channel is enabled with Preserve TD parameter set to 1. This preserves the
* original TD configuration and reload it after the transfer is complete so that the
TD
* can be repeated */
CyDmaChEnable(DMA_Chan, 1);
EoC ...
Bu
rs
t‘
N’ ….
DMA Transaction
DMA DMA complete
Interrupt Sample ‘N’
Request Done
(ISR)
(DRQ) (NRQ)
TD Pointer
TD[0]
Transfer
Source Destination Next TD DMA_DISABLE_TD
Count
Figure 9 shows the top design of the project. Each time the Pin_Switch is pressed; ISR_Switch is triggered, and a flag
is set in the isr to enable the DMA channel. Once the DMA channel is enabled, the EoC signal from ADC activates the
DMA channel request.
On each DMA request, the DMA fetches 2 bytes from the source – the ADC output register - writes them to the
destination RAM buffer, and increments the destination address by 2. The transfer count is decremented by 2 after
each burst transfer. This repeats until the transfer count is 0, which generates a transaction complete signal at the NRQ
terminal of the DMA component, which activates the ISR_DMA_Done interrupt.
In the interrupt service routine a flag is set to indicate that the transaction is complete. The DMA channel is disabled
when the transaction is completed, and re-enabled when the switch is pressed again.
Figure 9. Top Design, Peripheral-to-Memory Transfer
The channel configuration has the upper 16 bits of the 32-bit address for both the source and destination addresses.
The source address is same as in Example1.
CYDEV_SRAM_BASE, defined in the PSoC Creator auto-generated file cydevice.h, defines the base address of
SRAM. This is used with HI16 macro to specify the upper 16 bits of destination address.
As an alternative, the RAM array pointer can be used with HI16 macro to specify upper 16bits of source address for
PSoC 5LP but not for PSoC 3. This is because the upper 16 bits of the address of RAM variables is zero for PSoC 3,
but the Keil compiler stores Keil-specific information in the upper 16 bits of the variable address. For this reason, HI16
(&adc_sampleArray) returns an incorrect address when used with PSoC 3 – Keil compiler.
In this example, a 2-byte ADC result must be moved from ADC to RAM array on each DMA request and therefore the
burst count is set to 2 and the request per burst is set to true.
The Preserve TD is set to 1 (TRUE) so that the original TD setting, i.e. source address, destination address and transfer
count, are preserved and the transactions can be repeated.
The lower 16 bits of source and destination address are specified in the transaction descriptor (TD[0]) configuration as
given in Table 5.
Table 6. TD[0] Configuration Settings
Next TD DMA_DISABLE_TD
The transfer count is set to ‘400’ which is equal to the ‘Number of samples to be buffered × Bytes per Sample’.
The TD property is set to increment the destination address after each burst transfer and generate a transaction
complete signal once the specified number of samples is buffered. In PSoC 3 project, the TD is also configured to swap
the bytes while moving data from ADC to memory as explained in TD property section. The bits corresponding to each
of the TD property is defined in the PSoC Creator auto-generated file CyDmac.h. The required property bit fields are
OR-ed together to set the TD property.
In order to stop the DMA transfers after buffering the specified number of samples, TD[0] is chained to
‘DMA_DISABLE_TD’ which disables the DMA channel.
8 Bit
Destination : DAC
Location 1 Burst1 DMA Channel
Location 2
Increment Burst2
Read Write 1 Byte DAC
Source ...
Address
...
N
…. rst
Bu
TD[0]
Transfer
Source Destination Next TD Loop back to
Count
same TD
A sine lookup table with 128 points is stored in flash memory. These values are sequentially sent to a DAC, using DMA,
to create a sine wave. Figure 11 shows the top design for the project.
A clock component is used to periodically generate DMA requests (drq). When the request is received, the DMA channel
fetches one byte of data from the lookup table and writes it to the DAC data register. The source address is incremented
by one and the transfer count is decremented by one after each burst transfer. This continues until all table values are
sent to DAC.
The TD configuration is preserved and reloaded at the end of the transfer so as to generate a continuous sine wave.
The frequency of the sine wave is equal to the DMA trigger clock frequency divided by number of points in the lookup
table.
HI16(CYDEV_PERIPH_BASE)
Upper Destination Address
The source for DMA transfer is the sineTable array that is kept in flash memory. The HI16(&sineTable) sets the upper
16 bits of the source address for PSoC 5LP whereas HI16(CYDEV_FLS_BASE) is used to identify the upper 16 bits of
source address for PSoC 3 for the reasons mentioned in the previous examples.
The DMA channel must move one byte from look up table array to DAC for each DMA request. So, the burst count is
set to 1 byte and the request per burst is set to true.
The original TD configurations are preserved so that it can be re-used.
The lower 16 bits of source and destination addresses are set using the LO16 macro as given in Table 8.
Table 8. TD[0] Configuration
The transfer count is set to the total number of bytes in the sine look up table.
The TD is configured to increment the source address, i.e. look up table pointer, after each burst transfer.
At the end of the transfer, one complete cycle of sine wave is generated at the DAC output. The TD is preserved and
looped back to itself so as to generate a continuous wave.
8 Bit
DMA Channel 8 Bit
SrcArray[0] 1 byte
1 byte DestArray[0]
Increment SrcArray[1]
DestArray[1]
Increment
Source Read Write Destination
...
Address ... Address
...
… … ...
….
… … ….
SrcArray[N-1]
DestArray[N-1]
DMA transaction
DMA complete
DMA Interrupt
CPU Request Done
Request (ISR)
(NRQ)
TD Pointer
TD[0]
Transfer
Source Destination
Count
Next TD DMA_DISABLE_TD
Figure 13 shows the top design of the project. The CyDmaChSetRequest function is used to activate the DMA transfer
approximately one second after device power up.
When it receives a request from the CPU, the DMA transfers 8 bytes from the flash array to the RAM array as configured
in the channel and TD configuration registers. The TD source and destination addresses are incremented as the
transfer proceeds.
When the transfer is complete, a pulse is generated at the nrq signal terminal of the DMA. This activates the
ISR_DMADone interrupt which sets the flag to indicate that the transfer is complete. The new RAM contents are then
displayed on the LCD.
The source for DMA transfer is the ‘sourceArrray’ defined in the flash memory. The destination is ‘destinationArray’ in
RAM. The upper 16 bits of the source address in flash are set to HI16(&sourceArray) in PSoC 5LP and
HI16(CYDEV_FLS_BASE) in PSoC 3, as explained in previous examples. Similarly, the upper 16 bits of the destination
address in SRAM are set using the macro HI16(CYDEV_SRAM_BASE).
The burst count is set to 1 byte so that the DMA reads byte by byte from flash and writes it to the RAM array. You can
set the burst count to 8 bytes for faster data transfers. However, you should also generally set the burst count to a low
value so as to allow the spoke to be shared by other DMA channels.
The request per burst parameter is set to false so that separate requests are not required for each burst transfer.
Table 10. TD[0] Configuration
The lower 16 bits of the source and the destination addresses for the TD configuration are identified by the LO16 macro.
The transfer count is set to 8 so that a total of 8 bytes are transferred from the source to the destination.
The TD is configured to increment the source address i.e., the flash array pointer, and the destination address i.e., the
RAM array pointer, after each burst transfer. The TD is also configured to send a termout pulse on the nrq line after all
the 8 bytes are moved from the flash to the RAM array. This pulse is used to trigger an ISR to indicate that the transfer
is complete. The next TD is set to DMA_DISABLE_TD (0xFE) to disable the DMA channel after the transfer is finished.
Since the transaction has to happen only one time, the TD configuration does not need to be preserved.
10 Example 5: TD Chaining
This example project shows how to use multiple TDs with a single channel and chain them to one another. In this
example the ADC data is sent to two separate RAM buffers, one after the other, using a single DMA channel and two
TDs.
The DMA channel is configured to do two transactions:
Sample 1
Sample 2
1
rst t2 ...
Source : ADC Bu Burs
...
DMA Channel
….
ADC 2 Bytes Read Write
Sample N1
Burst N1
EoC Bur TD1àTD0 Increment
st ( Destination2 : RAM TD0àTD1
N1+ Destination
1) Buffer2
16 bit Address
Bu
Sample 1
r
st
(N
...
…. DMA Transaction
TD Pointer complete signal
Sample N2
TD[0] TD[1]
Transfer Transfer
Source Destination Next TD Source Destination Next TD
Count Count
TD0 Property : Increment Destination address TD1 Properties : Increment Destination address,
: Generate transaction complete signal
This form of TD configuration can also be used to overcome the maximum transfer count limit of a single TD, which is
4096 bytes for a single DMA channel. Note that the upper 16 bits of the source and the destination addresses must be
the same for all of the TDs in a chain.
The top design for the project is the same as in Example 2.
Parameter Setting
The channel and TD configurations are similar to Example 2. The Next TD parameter of TD[0] is set to TD[1], and vice
versa, to chain the transactions.
Next TD TD[1]
11 Summary
This application note has described the DMA controller in PSoC 3 and PSoC 5LP. Using simple PSoC Creator example
projects, the application note has also shown how to configure the DMA for different types of data transfers. For more
advanced information, see the PSoC 3 and PSoC 5LP Technical Reference Manuals and the PSoC Creator DMA
component datasheet.
The API function DmaInitialize() configures several DMA channel parameters as follows:
▪ DMA_BYTES_PER_BURST: the number of bytes to be read and written by the DMA channel in one burst
For example, if you want to define DMA to collect 8-bit ADC data, set this parameter to 1 because the DMA channel
must move 1 byte from source to destination on each request. Or, if you want to collect 16-bit ADC data, set this
parameter to 2.
▪ DMA_REQUEST_PER_BURST: whether each burst must have a separate request.
If set to 1, each burst transfer must be individually requested. If set to 0, all subsequent bursts after the first burst
are automatically carried out without separate request. (Only the first burst transfer must have a DMA request.)
▪ HI16(Source Address): the upper 16 bits of the source address. HI16 is a macro created by PSoC Creator to
specify the upper 16 bits of a 32-bit value or address.
▪ HI16(DestinationAddress): the upper 16 bits of the destination address. Use macros provided in the previous
table to identify the upper 16 bits of source and destination addresses in PSoC 3.
The PSoC 3 Keil compiler stores Keil-specific information in the upper 16 bits of the variable addresses. For this
reason, use the following constants shown in Table 14. They are defined in CyDevice.h along with HI16 macro to
configure the upper 16 bits of source and destination address for PSoC 3 especially when the source or destination
for the DMA transfer is RAM or flash memory.
Table 14. Upper 16-bit Address Macros
Source DMA_SRC_BASE
Peripheral CYDEV_PERIPH_BASE
RAM CYDEV_SRAM_BASE
Flash CYDEV_FLS_BASE
Step2: TD allocation
TD_Handle = CyDmaTdAllocate();
The API function CyDmaTdAllocate() creates an instance of a TD and returns the handle to that TD. The TD handle is
used by other APIs to configure the TD. To create multiple TDs, call the function multiple times.
Step 3: TD configuration
CyDmaTdSetConfiguration(TD_Handle,
Transfer_Count,
Next_TD,
TD_Property);
The API function CyDmaTdSetConfiguration() configures a TD, using the following parameters:
TD_SWAP_EN Perform endian swap; swap bytes while moving data from source to destination.
TD_SWAP_SIZE4 Set swap size = 4 bytes. Default swap size is 2 bytes.
TD_AUTO_EXEC_NEXT The next TD in the chain is activated automatically when the current TD finishes.
End this TD if a positive edge on the trq input line occurs. The positive edge must occur
TD_TERMIN_EN
during a burst. That is the only time the DMAC listens for it.
If this flag is used, a pulse is generated on the nrq line when the TD transfer is complete.
This flag is specific to a DMA component instance and is defined in the component instance
DMA__TD_TERMOUT_EN header file. For example, if the DMA component instance name is DMA_1 in the top design,
the termout macro for the instance is ‘DMA_1__TD_TERMOUT_EN’ which is included in
DMA_1_dma.h.
TD_INC_DST_ADR Increments destination address according to the size of each data burst transaction.
TD_INC_SRC_ADR Increments source address according to the size of each data burst transaction.
The API function CyDmaTdSetAddress() sets the source and destination addresses of a TD, using the following
parameters:
PSoC is highly programmable - many components are created from the programmable digital and analog blocks, and
the physical location of a peripheral may change based on the design. Therefore, a conventional register map listing
all the source and destination addresses is not possible
Instead, the registers for each component are defined in the component API header files generated by PSoC Creator
during the build process. You should review these header files to identify the component’s register addresses.
▪ Channel_Handle: the handle of the DMA instance returned by the DMA_DmaInitialize() function
▪ TD_Handle: a handle previously returned by the CyDmaTdAllocate() function
▪ Channel_Handle: the handle of the DMA instance returned by the DMA_DmaInitialize() function
▪ Preserve_TD: if TRUE, the DMA channel retains the TD configurations (source, destination and transfer count) so
that the TD can be repeated
A.1 Other Important DMA API Functions
To activate a DMA channel from a CPU request, use this function:
CyDmaChSetRequest(Channel_Handle, CPU_REQ);
DMA component
instance name
Single Chain or Loop: this defines what ‘Next TD’ for the last TD in the chain. If single chain, the next TD is
DMA_DISABLE_TD (0xFE). If loop, it is the first TD.
Click Next when done.
Step 3: Define the transaction descriptors for the channel
Select the DMA transfer global settings, as Figure 17 shows. Table 16 describes each TD configuration parameter.
Figure 17. Add Transaction Descriptors
Field Description
Auto Next Automatically execute the next TD without another DMA request.
Next TD The next logical TD in the chain of TDs. Set to END if this TD chain is finished with this TD.
For more information on the wizard, see the PSoC Creator Help file.
When both the CPU and DMAC request access to the same spoke on PHUB at the same time, the CPU has priority
by default. The PHUB manages arbitration between DMA and CPU, and among the DMA channels. For more
information, see PSoC® 3, PSoC® 5LP Architecture TRM.
7. Press F5 to run the program. Press the switch (SW1) connected to P6[1] to enable the DMA to start ADC sample
buffering. The execution stops at the breakpoint after the DMA has transferred the specified number of samples
from ADC to memory. The result can be verified by monitoring the adc_sampleArray in the watch window, as
Figure 23 shows:
Figure 23. ADC Samples in Watch Window
0 0 0 1 0 2 0 3 0 4 0 5 0 6 0 7
T R A N S F E R R E D
7. Press F5 to run the program. Press the switch (SW1) connected to P6[1] to enable the DMA to start ADC sample
buffering. The execution stops at the breakpoint after the DMA has transferred the specified number of samples
from ADC to memory. To verify the result, monitor adc_sampleArray1 and adc_sampleAv rray2 in the watch
window, as Figure 28 shows.
Figure 28. ADC Samples in Watch Window
Document History
Document Title: AN52705 - PSoC® 3 and PSoC 5LP - Getting Started with DMA
Document Number: 001-52705
All other trademarks or registered trademarks referenced herein are the property of their respective owners.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
© Cypress Semiconductor Corporation, 2009-2018. This document is the property of Cypress Semiconductor Corporation and its subsidiaries, including
Spansion LLC (“Cypress”). This document, including any software or firmware included or referenced in this document (“Software”), is owned by Cypress
under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such laws and
treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other intellectual
property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with Cypress governing
the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to sublicense) (1) under its
copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for use with Cypress hardware
products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end users (either directly or indirectly
through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of Cypress’s patents that are infringed
by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for use with Cypress hardware products.
Any other use, reproduction, modification, translation, or compilation of the Software is prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD
TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. No computing device can be absolutely secure. Therefore, despite security
measures implemented in Cypress hardware or software products, Cypress does not assume any liability arising out of any security breach, such as
unauthorized access to or use of a Cypress product. In addition, the products described in these materials may contain design defects or errors known
as errata which may cause the product to deviate from published specifications. To the extent permitted by applicable law, Cypress reserves the right to
make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or circuit
described in this document. Any information provided in this document, including any sample design information or programming code, is provided only
for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and safety of any
application made of this information and any resulting product. Cypress products are not designed, intended, or authorized for use as critical components
in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or systems, other medical
devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous substances management, or other uses
where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A critical component is any
component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or system, or to affect its safety
or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim, damage, or other liability arising
from or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and against all claims, costs, damages,
and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, WICED, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are
trademarks or registered trademarks of Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit
cypress.com. Other names and brands may be claimed as property of their respective owners.