lpcware

ADC Burst mode - DONE flag never cleared

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by ArnaudE on Thu Jul 30 07:48:26 MST 2015
Hello,

I'm working on LPC1833 and FreeRTOS. I'm sampling only one channel in burst mode and I'm using the ADC0 peripheral. I'm using the Analog Inputs (not the shared ones with GPIO and other functions). I also use the ADC interrupt to copy the data from the registrer using the Chip_ADC functions from adc_18xx_43xx.c.

The problem is that the DONE flag for the ADC Data register of Channel 0 isn't cleared by the chip after I read the register in the interrupt routine. And the interrupt is always trigerring. The UM says : 43.6.2 A/D Global Data register  "This bit (DONE) is set to 1 when an analog-to-digital conversion completes. It is cleared when this register is read and when the AD0/1CR register is written. If the AD0/1CR is written while a conversion is still in progress, this bit is set and a new conversion is started.". So normally i have no flag to clear by software. I am right?

Or may am I having trouble with freeRTOS and the use of this interrupt.

Regards.

        
void IO_ADC_Init(void)
{
    ADC_CLOCK_SETUP_T ADCSetup;       
       
    Chip_ADC_Init(LPC_ADC0, &ADCSetup);
    ADCSetup.bitsAccuracy = ADC_10BITS;
    ADCSetup.burstMode = 1; //ENABLE
    Chip_ADC_Int_SetGlobalCmd(LPC_ADC0, DISABLE);
    Chip_ADC_Int_SetChannelCmd(LPC_ADC0,0,ENABLE);
    Chip_ADC_SetBurstCmd(LPC_ADC0, ENABLE);
    Chip_ADC_SetSampleRate(LPC_ADC0, &ADCSetup, 400U);
       
    Chip_ADC_EnableChannel(xpAdcInputParameters[u8i].pxADC, xpAdcInputParameters[u8i].xChannel, ENABLE);
       
    NVIC_EnableIRQ(ADC0_IRQn);
}

Outcomes