How do I get 200kHz sampling rate of ADC?

13 Aug 2012

Can anyone explain to me how I get a 200 kHz sampling rate?

So far I'm able to get 48.9 kHz, I'd like to go as fast as possible.

I read this: http://mbed.org/forum/mbed/topic/319/, but the link at the bottom appears to be dead.

13 Aug 2012

The following posts says to not use AnalogIn, but operate on the ADC directly: http://mbed.org/forum/mbed/topic/480/?page=1#comment-2424

If this is the way to go above 50 kHz, can anyone explain to me how to do it, perhaps with an example? I've been reading in the LPC17xx User manual, but I'm not sure I really understand how to do it.

15 Aug 2012

The link at the bottom of the first place you link is to the lpc header file, so there you can look up the register names, but it wont tell you how to do it. You can do it by manually setting the register, it is a matter of then following the User Manual and set each relevant register.

No experience with it, but this might help you: http://mbed.org/forum/mbed/topic/486/

15 Aug 2012

I'll give you a hint, not an exactly implementation. You need to access every register, and configure manual. I'll give a code example, the comments are saying what every line is does. So in this case the clock of ADC is 12MHz, is almost 200KHz rate of conversion, go to manual and read what value to set registers PCLKSEL0 (main clock, and use clock/2 option) and use register ADCR to set prescaler to reduce the clock to 13MHz, with 13MHz you will have 200KHz ate of conversion.

Edit: I uploaded a .txt file with he code example. /media/uploads/catalin88/adc.txt

17 Aug 2012

Thanks guys. I will take a look at it over the weekend :)