Part Number: TMS320F280025
Other Parts Discussed in Thread: C2000WARE
Hi expert,
I am helping customer porting from F28034 to F280025.
For ADC initiation, it looks big difference.
here is the F28034 code
EALLOW;
AdcRegs.ADCCTL1.bit.RESET = 1; //did not find, does F280025 also have this bit, and also need to do it ?
asm(" NOP ");
asm(" NOP ");
AdcRegs.ADCCTL1.bit.ADCREFSEL = 0; // ADC reference, have changed successfully
AdcRegs.ADCCTL1.bit.ADCBGPWD = 1; // did not find, does F280025 also have this bit, and also need to do it ?
AdcRegs.ADCCTL1.bit.ADCREFPWD = 1; // did not find, does F280025 also have this bit,does internal reference enable by another module or enable always?
AdcRegs.ADCCTL1.bit.ADCPWDN = 1; // power up ADC, have changed successfully
AdcRegs.ADCCTL1.bit.ADCENABLE = 1; // did not find, does F280025 also have this bit, and also need to do it ?
DELAY_US(ADC_usDELAY);
AdcRegs.ADCCTL1.bit.INTPULSEPOS = 0;
AdcRegs.ADCCTL2.bit.ADCNONOVERLAP = 1; // did not find, does F280025 also have this bit, and also need to do it ?
I did not find many registers, could you kindly help to answer my questions in comment?
According to the F280025 TRM describes:
Power-Up Sequence
Upon device power-up or system level reset, the ADC will be powered down and disabled. When
powering up the ADC, use the following sequence:
1. Set the bit to enable the desired ADC clock in the PCLKCR13 register.
2. Set the desired ADC clock divider in the PRESCALE field of ADCCTL2.
3. Power up the ADC by setting the ADCPWDNZ bit in ADCCTL1.
4. Allow a delay before sampling. See the data manual for the necessary time.
I got the responding code as below:
EALLOW;
AnalogSubsysRegs.ANAREFCTL.bit.ANAREFASEL=0;
AnalogSubsysRegs.ANAREFCTL.bit.ANAREFCSEL=0;
AnalogSubsysRegs.ANAREFCTL.bit.ANAREFA2P5SEL =0
AnalogSubsysRegs.ANAREFCTL.bit.ANAREFC2P5SEL=0;
//
// Set ADCCLK divider to /4
//
AdcaRegs.ADCCTL2.bit.PRESCALE = 6;
//
// Set pulse positions to early
//
AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 0;
//
// Power up the ADC and then delay for 1 ms
//
AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;
EDIS;
DELAY_US(1000);
Could you kindly help to review whether I leave some configuration or not?
BR
Emma