This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28035 ADC错位

Other Parts Discussed in Thread: TMS320F28035

Dear Teams,

我的客户在使用TMS320F28035的时候,写入的ADC通道和读取的不一样。具体信息参照以下:

下图是代码里把通道0和1配置为B1, 2和3配置为B2, 4和5配置为B6,6为A3, 7为A5等等。然后给不同通道不同电压,然后从寄存器的RESULT寄存器去读取数据,发现:最后发现从B1读取到的数据是1和2通道的,B2读到的是3和4通道的,B6读到的是5和6通道的,出现了往后移位。ADC寄存器的配置见附件。麻烦帮忙看下这会是什么原因导致的,或者有什么建议吗?谢谢1731.adc.C

5707.ADC_SOC_Cnf.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//----------------------------------------------------------------------------------
// FILE: ADC_SOC_CNF.c.c
//
// Description: ADC configuration to support up to 16 conversions on
// Start of Conversion(SOC) based ADCs (type 3) found on F2802x and
// F3803x devices. Independent selection of Channel, Trigger and
// acquisition window using ChSel[],TrigSel[] and ACQPS[].
//
// Dependencies: Assumes the {DeviceName}-usDelay.asm is inlcuded in the project
// Version: 2.0
//
// Target: TMS320F2802x(PiccoloA),
// TMS320F2803x(PiccoloB),
//
// The function call is:
//
// void ADC_SOC_CNF(int ChSel[], int Trigsel[], int ACQPS[], int IntChSel, int mode)
//
// Function arguments defined as:
//-------------------------------
// ChSel[] = Channel selection made via a channel # array passed as an argument
// TrigSel[]= Source for triggering conversion of a channel,
// selection made via a trigger # array passed as argument
// ACQPS[] = AcqWidth is the S/H aperture in #ADCCLKS,# array passed as argument
// IntChSel = Channel number that would trigger an ADC Interrupt 1 on completion(EOC)
// if no channel triggers ADC interrupt pass value > 15
// Mode = Operating mode: 0 = Start / Stop mode, needs trigger event
// 1 = Continuous mode, no trigger needed
// 2 = CLA Mode, start stop mode with auto clr INT Flag
//================================================================================
#include "PeripheralHeaderIncludes.h"
void ADC_SOC_CNF(int ChSel[], int Trigsel[], int ACQPS[], int IntChSel, int mode)
{
extern void DSP28x_usDelay(Uint32 Count);
EALLOW;
AdcRegs.ADCCTL1.bit.ADCREFSEL = 0;
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // Power up band gap
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; // Power up reference
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; // Power up rest of ADC
AdcRegs.ADCCTL1.bit.ADCENABLE = 1; // Enable ADC
DSP28x_usDelay(1000); // Delay before converting ADC channels
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 1;
AdcRegs.ADCSOC0CTL.bit.ACQPS = ACQPS[0];
AdcRegs.ADCSOC1CTL.bit.ACQPS = ACQPS[1];
AdcRegs.ADCSOC2CTL.bit.ACQPS = ACQPS[2];
AdcRegs.ADCSOC3CTL.bit.ACQPS = ACQPS[3];
AdcRegs.ADCSOC4CTL.bit.ACQPS = ACQPS[4];
AdcRegs.ADCSOC5CTL.bit.ACQPS = ACQPS[5];
AdcRegs.ADCSOC6CTL.bit.ACQPS = ACQPS[6];
AdcRegs.ADCSOC7CTL.bit.ACQPS = ACQPS[7];
AdcRegs.ADCSOC8CTL.bit.ACQPS = ACQPS[8];
AdcRegs.ADCSOC9CTL.bit.ACQPS = ACQPS[9];
AdcRegs.ADCSOC10CTL.bit.ACQPS = ACQPS[10];
AdcRegs.ADCSOC11CTL.bit.ACQPS = ACQPS[11];
AdcRegs.ADCSOC12CTL.bit.ACQPS = ACQPS[12];
AdcRegs.ADCSOC13CTL.bit.ACQPS = ACQPS[13];
AdcRegs.ADCSOC14CTL.bit.ACQPS = ACQPS[14];
AdcRegs.ADCSOC15CTL.bit.ACQPS = ACQPS[15];
AdcRegs.INTSEL1N2.bit.INT1SEL = IntChSel; // IntChSel causes ADCInterrupt 1
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX