This article is organized according to the following links:
Http://bbs.21ic.com/icview-690422-1-1.html
http://blog.csdn.net/wu159632/article/details/7543599
Http://bbs.21ic.com/icview-800778-1-1.html
Look in turn:
First, the official website routine
Dmach1burstconfig (3,1,10);//
Dmach1transferconfig (9,1,0);//
Dmach1wrapconfig (1,0,0,1);//
Cnsxgh reply:
Landlord This example should be inside the ADC-DMA. According to the landlord of this program, there should be only 3 channels. The hypothesis is adc1,adc2,adc3,adc4.
The corresponding destination address is dma[0]-dma[30].
Dmach1burstconfig (3,1,10);//Here, BURST3 a word, indicating that the ADC has four channels. The source address step is 1, indicating that the source address pointer ADC1 is finished ADC2 is ADC3
The target address step is 10, which means that the data moved from ADC1 to Dma[0],adc2 is moved to DMA[10],ADC3 data to dma[20].
Dmach1transferconfig (9,0,1),//9, said 10 times.
Dmach1wrapconfig (0,0,0,1);//The first 0, indicating a transfer after the address wrapping, the second 0, wrapping step does not grow. The fourth, 1, indicates that the target address wraps up after 1. That is, the second round acquisition, ADC1->DMA[1],ADC2->DMA[11],ADC3->DMA[21]
Second, the number of frames, the number of frames to explain
DMA (Direct memory access), directly storage access, is a mechanism for fast data transfer. The advantage of this is that once the controller is initialized, the data is transferred, and the DMA can be separated from the CPU to complete the data transfer. There is no need for a large amount of interrupt load on the CPU, which saves a lot of CPU resources.
The tms320f28335 has 6-channel DMA, and each channel has a separate pie interrupt. There are many types of triggering sources for DMA, which can be configured as ADCs, Mcbsps, external interrupts, CPU timers, epwm1-6 Adcsoca and ADSOCB, and software. DMA can be used for data operation on L4-L7 16kx16 SARAM, xintf external interface, ADC, Mcbsps, epwm1-6/hrpwm1-6 mapped to peripheral Frame 3 space registers. The mode of operation can be configured as either 32-bit or 16-bit. Throughput is up to 4:/word. It is important to note that when DMA Mcbsps data operations, it can only be configured to 16-bit mode of operation, and the maximum throughput is 5:/word. Refer to TI's data sheet for specific reasons. The following is an example of TI's example to explain the DMA configuration in detail.
28335 DMA configuration is mainly a few functions, can be found in the DSP2833X_DMA.C.
Functions and configuration:
void Dmachxaddrconfig (volatile Uint16 *dma_dest,volatile Uint16 *dma_source)
Parameter resolution: Configure DMA Data Destination address and source address (same as parameter in function, same as below).
void Dmachxburstconfig (Uint16 bsize, Int16 srcbstep, Int16 desbstep)
Parameter resolution: Configure the size of each frame, increase the offset in the intra-frame source address, and increase the offset in the intra-frame source address. An increase in the address offset means that the address increment is transmitted after a word (or frame).
void Dmachxtransferconfig (Uint16 tsize, Int16 srctstep, Int16 deststep)
Parameter resolution: Configure how many frames per time the DMA transfer is triggered, increase the offset between frame source addresses and increase the offset between frame source addresses.
void Dmachxwrapconfig (Uint16 srcwsize, Int16 srcwstep, Uint16 deswsize, Int16 deswstep)
Parameter resolution: Configure the total source address offset, the source address of the overload, the total destination address offset, the destination address of the overload. That is, the new source address (or destination) that is set is overloaded when the offset of the source address (or destination) exceeds the set offset amount. That's how I understand it.
void Dmachxmodeconfig (Uint16 persel, Uint16 perinte, Uint16 oneshot, Uint16 cont, Uint16 synce, Uint16 Syncsel, Uint16 OVR Inte, Uint16 datasize, Uint16 chintmode, Uint16 chinte)
Parameter resolution: Configure Trigger Source Selection, trigger source Enable, oneshot Enable, continue mode enable, peripheral synchronization Enable, synchronization object selection (source synchronization or destination synchronization), overflow interrupt enable, mode of operation selection (16-bit or 32-bit), interrupt mode selection (start or end), interrupt enable.
Three, with the number of pulses and frames to explain
void Dmach1addrconfig (volatile Uint16 *dma_dest,volatile Uint16 *dma_source)
There are two source addresses, one for transfer (incremented with each byte), and another B as the returned backup (when a frame is finished, reload a)
The destination address has two, one for transfer (increments with each byte) and another B as the returned backup (when a frame is finished, reload a)
Each time the DMA corresponding channel is started, B is loaded into a
void Dmach1burstconfig (Uint16 bsize, Int16 srcbstep, Int16 desbstep)
Bsize: The number of words each pulse transmits, the actual number of pulses is bsize+1
Srcbstep: After each word is passed, the source address a increments
Desbstep: After each word is passed, the destination address a increments
void Dmach1transferconfig (Uint16 tsize, Int16 srctstep, Int16 deststep)
Tsize: The number of pulses per frame, the pulse is decremented to 0 o'clock (that is, a frame pass is complete, and the DMA is transferred), resulting in a DMA interrupt. The actual number of frames is tsize+1
Srctstep: After the last word of each pulse is passed, the source address a increments
Deststep: After the last word of each pulse is passed, the destination address a increments
void Dmach1wrapconfig (Uint16 srcwsize, Int16 srcwstep, Uint16 deswsize, Int16 deswstep)
Srcwsize: When the number of pulses passed is an integer multiple of srcwsize+1, the source address (B) is incremented by srcwstep (usually 0) and loaded into the source address a
Deswsize: When the number of pulses passed is an integer multiple of deswsize+1, the destination address (B) is incremented by deswstep (usually 0) and loaded into the destination address a
void Dmach1modeconfig (Uint16 persel, Uint16 perinte, Uint16 oneshot, Uint16 cont, Uint16 synce, Uint16 Syncsel, Uint16 OVR Inte, Uint16 datasize, Uint16 chintmode, Uint16 chinte)
Persel: Select the peripheral interrupt source that triggers the DMA
Perinte: Peripheral interrupt Enable,
Oneshot: When enabled, the peripheral generates a single interrupt and is able to pass a frame. No, the peripheral generates an interrupt and only transmits one pulse
Cont: When enabled, you do not need to call void StartDMACH1 (void) When you need to start DMA again at the end of each DMA. Disable, restart DMA, need to call void StartDMACH1 (void)
DataSize: Set each word to be 16-bit or 32-bit
Chintmode: Setting DMA interrupts is generated at DMA start or end
CHINTE:DMA interrupt enable (peripheral level) for the corresponding channel.
Note: When the Perinte and Chinte are enabled at the same time, they can enter the DMA channel interrupt
Only perinte enable, can transfer data, but does not enter the channel interrupt program
void StartDMACH1 (void)
The first time the DMA is started, if the cont is disabled, the DMA needs to be called after each DMA end
Only turn on the corresponding peripheral level interrupt for triggering, do not turn on the pie corresponding bit, it can trigger DMA without triggering the interrupt program of CPU.
After a dmach1modeconfig configured interrupt, the DMA automatically clears the interrupt flag bit for the corresponding peripheral level without program cleanup.
Three a combination, you see.
Configuration and use of DMA in DSP28335