Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21975

Starterware/MSP430FR6972: The question of DMA

$
0
0

Part Number:MSP430FR6972

Tool/software: Starterware

Hello , 

I  want to use DMA tran tansmit ADC data to FRAM . The ADC mode is Repeat-Sequence-of-Channels Mode  from ADC12MCTL0 to ADC12MCTL1, ADC trigger signal is  TA0.1 . the code is following

//ADC12(internal) trigger ,TA0.1 PWM 8.192KHz from 32.768KHz crystal oscillator
TA01_PWMOUT(4, 2, TASSEL__ACLK);
// Set ADC channel pins
ADC_Pin_Set();

ADC12CTL0 &= ~ADC12ENC;
ADC12CTL0 |= ADC12ON;

//ADC12_B sample-and-hold time 
ADC12CTL0 |= ADC12SHT1_1;
//a rising edge of the SHI signal to trigger each sample-and-convert
ADC12CTL0 &= ~ADC12MSC;
// ADC trigger TA0.1, ADC clock is SMCLK
ADC12CTL1 |= ADC12SHP |  ADC12SHS_1 | ADC12PDIV__1 | ADC12DIV_0 | ADC12SSEL_3;
// Repeat-sequence-of-channels
ADC12CTL1 |= ADC12CONSEQ_3;
//12bit ADC
ADC12CTL2 |= ADC12RES_2;
//Start Mem
ADC12CTL3 = ADC12CSTARTADD_0;
//MemCtl set
ADC12MCTL0 |= ADC12INCH_2 | ADC12VRSEL_1;
ADC12MCTL1 |= ADC12INCH_3 | ADC12VRSEL_1;
//End Mem
ADC12MCTL1 |= ADC12EOS;

//DMA Set
DMACTL0 |= DMA1TSEL__ADC12IFG;    
__data16_write_addr((unsigned short) &DMA1SA,(INT16U)  &ADC12MEM1);                                               
__data16_write_addr((unsigned short) &DMA1DA,(INT16U)  &ElecfieldBuffer[0]); 	
DMA1SZ = 5120;   
DMA1CTL = DMADT_4 | DMADSTINCR_3 | DMASRCINCR_0 |DMASWDW |DMAEN ; 

"When CONSEQx = {1,3}, theADC12IFG flag for the last ADC12MEMx in the sequence can trigger a DMA transfer. " (Page 336 of MSP430FR6972 User's Guide) . I know  that  only the ADC12IFG of ADC12MEM1 can trigger a DMA transfer , But I found it not as . The DMA wasted 625ms to accomplish 5120 points . However,the theory of time shoud be (1/8.192KHz) * 2 * 5120  = 1250ms . Why is it ?

Best Regards,

Jent


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>