Part Number: MSP430FR5949
We are having a issue with using port P1.4 to measure low voltage, below 5mV. The input of P1.4 is buffered. When the input is 2mV, we have to add a 30sec delay after 'ADC12CTL0 |= ADC12ENC | ADC12SC' sentence, otherwise, the measurement result is 0 or 1 count. Does anybody have a clue what's the reason for this? Thanks in advanced.
//Turn on Power
Power_Port_DIR |= Acc_On;
Power_Port_OUT |= Acc_On;
// Configure ADC
ADC_PORT_SEL1 |= RMS_ADC;
ADC_PORT_SEL0 |= RMS_ADC;
ADC12CTL0 &= ~ADC12ENC; //enable modification
ADC12CTL0 = ADC12SHT0_2 + ADC12ON + ADC12MSC; // ADC12ON, S&H=64 ADC clks; 5M/(64+15)=65.8KHz
ADC12CTL1 = ADC12SSEL_0 + ADC12SHS_0 + ADC12SHP + ADC12DIV_5 + ADC12CONSEQ_2 ; // ADCCLK = MODOSC = 5MHz
//ADC12SC bit,sample-and-hold source select
//SAMPCON signal is sourced from the sampling timer //Divide by 6= 833333
//Repeat-single-channel
ADC12CTL2 = ADC12RES_2; // 12-bit conversion results
ADC12MCTL0 = ADC12INCH_4 +ADC12VRSEL_1;
while(REFCTL0 & REFGENBUSY); // If ref generator busy, WAIT
REFCTL0 |= REFVSEL_1+REFON; // Select internal ref = 2.0V
ADC12CTL0 |= ADC12ENC | ADC12SC ; // Start conversion
configureTimer_B0(150); //150*0.2 = 30 sec
while(!timed_outB0) __bis_SR_register(LPM3_bits + GIE);
TB0CTL = MC_0 ; //MC==00 HALTED
timed_outB0 = 0;
for (i=0; i<tSample; i++)
{
// movingAVG = 0;
// ADCresult = 0;
// for (j=0; j<256; j++)
// {
while (!(ADC12IFGR0 & BIT0));
// movingAVG += ADC12MEM0;
// }
// ADCresult = movingAVG >> 4;
// ADCresult = movingAVG/10;
// __delay_cycles(1000000);
*FRAM_write_ptr++ = ADC12MEM0;
}
ADC12CTL0 &= ~ADC12SC;