5086 views|0 replies

1140

Posts

0

Resources
The OP
 

TMS320F28377 study notes - triggering ADC continuous sampling through timer [Copy link]

As the latest product of TI's C2000 series, 28377S(D), the ADC module is its core signal acquisition function. The ADC of 28377 is a successive approximation register (SAR) ADC with a selectable resolution of 16 bits or 12 bits. The specific ADC characteristics are shown in the data sheet below:


In this study, I used the Timer as the trigger source to trigger the continuous conversion of the ADC on SOC0. As can be seen from the above figure, the trigger types supported by the ADC are:

Software trigger
All EPWM-ADCSOCA or B
GPIO XINT2
CPU Timer 0/1/2 (for each C28x core)
ADCINT1/2
Therefore, it is feasible to trigger sampling through the CPU timer. Let's take a look at the module block diagram of ADC:


We use the Timer to trigger the ADC's SOC0 conversion sequence to continuously sample ADCIN0: the sampling mode is single-ended 12-bit sampling.

Next, you need to configure the ADC's SOC sampling sequence, including the sampling window time, conversion channel selection, trigger source selection, etc.:

The following is the program part:

void ConfigureADC(void){

EALLOW;
AdcaRegs.ADCCTL2.bit.PRESCALE = 6; //ADC clock pre-division: 200M/4=50MHz
AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE); //Configure ADCA to 12-bit conversion accuracy, single-ended mode
AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1; //ADC interrupt pulse position occurs at the end of the conversion, one cycle before the ADC result is latched into the result register
AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1; //All analog circuits in the core are powered on
DELAY_US(1000); //delay for 1ms to allow ADC time to power up
EDIS;Uint16 acqps;

if(ADC_RESOLUTION_12BIT == AdcaRegs.ADCCTL2.bit.RESOLUTION)
{
acqps = 14; //The fastest sampling time in 12-bit single-ended mode is 75ns, ACQPS>=14,
}
else //resolution is 16-bit
{
acqps = 63; //The fastest sampling time in 16-bit differential mode is 320ns, ACQPS>=63
}

EALLOW;
AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0; //SOC0 will convert ADCINA2
AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //Set the sampling window time
AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 2; //SOC0 trigger source selection is CPU1 Timer1
AdcaRegs.ADCINTSEL1N2.bit.INT1SEL = 0; //EOC0 triggers ADCINT1
AdcaRegs.ADCINTSEL1N2.bit.INT1E = 1; //ADCINT1 interrupt enable
AdcaRegs.ADCINTFLGCLR.bit.ADCINT1 = 1; //ADCINT1 interrupt flag clear
EDIS;}

This post is from Microcontroller MCU
 

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building, Block B, 18 Zhongguancun Street, Haidian District, Beijing 100190, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list