lpcware

LPC11C14: ADC 400 kSamples/s - can't reach more than 200k/Samples

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Ano on Sat Nov 15 07:51:47 MST 2014
I currently try to get the ADC of the LPC11C14 to work with a 400kHz Sampling frequency. I want to be able to toggle some Pins between some Samples (to change the gain factor of my OPAMP circuit).
My problem now is: I can't get near the 400 kHz. I'm working with the LPCopen Libs and tried to use the example codes.
When trying to measure the sampling time for one sampling action by toggling a pin before and directly after the sampling


while (1)
{
      Chip_GPIO_SetPinToggle(LPC_GPIO, 2, 4);   <-----------------------------------------------
                                                                                               |
      /* Start A/D conversion */                                                               |
      Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);                   |
                                                                                               |                                                                           
      /* Waiting for A/D conversion complete */                                                |
      while (Chip_ADC_ReadStatus(LPC_ADC, ADC_CH0, ADC_DR_DONE_STAT) != SET) {}                |
                                                                                               |
      /* Read ADC value */                                                                     |
      Chip_ADC_ReadValue(LPC_ADC, ADC_CH0, &dataADC);                                          |
                                                                                               |
      Chip_GPIO_SetPinToggle(LPC_GPIO, 2, 4);  <------------------------------------------------
}

The time between the toggles (see arrows), is about 6µs. So the maximal frequency to get is about 166 kHz. A lot less than 400 kHz.


Then I tried the burst mode, getting an interrupt whenever a sample is ready. Even then, toggling a pin in this interrupt routine was only
at about 202 kHz.
Is this "10-bit conversion time >= 2.44 µs (up to 400 kSamples/s)." (source: LPC11Cx2/Cx4 datasheet)
and "10-bit conversion time >= 2.44 µs."  (source: UM10398)
a lie? (I know it says more than 2,44µs, but I wouldn't expect it to be more than the double....)

Does anyone have a simple code snippet actually reaching more than 200 kSamples/s ?

Outcomes