ADC channel mux speed

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by tweber on Wed Apr 03 05:33:11 MST 2013
I am using CMSIS to get values from internal ADC and I am polling (software control) the ADC.
Using interrupts is not an option.

What is the maximum speed for reading the ADC channels when muxing?

I have to add some nops between the calls of this function to get results.
If I call this function too early, the ChannelGetStatus never returns.

uint32_t foo(uint8_t channel)
    ADC_ChannelCmd((LPC_ADC_TypeDef *)LPC_ADC, channel, ENABLE);
    /* start integrated ADC */
    ADC_StartCmd((LPC_ADC_TypeDef *)LPC_ADC, ADC_START_NOW);

    /* wait for completion of sampling */
    while (!(ADC_ChannelGetStatus((LPC_ADC_TypeDef *)LPC_ADC, channel, ADC_DATA_DONE)));

    ADC_ChannelCmd((LPC_ADC_TypeDef *)LPC_ADC, channel, DISABLE);

    return ADC_ChannelGetData((LPC_ADC_TypeDef *)LPC_ADC, channel);