Increase ADC sampling rate via register/port manipulation
MezmerizeR last edited by
I'm very sorry if the following is a stupid question.
The Spresense documentation says:
The sampling frequency is set to 64Hz for LPADC and 16KHz for HPADC. (§ 1.15.1)
My problem is that I need to use a much higher sampling frequency when using the analog pins. Is it possible to increase the sampling frequency of the HPADC pins?
The CXD5602 user manual says on page 957:
Table ADC-771 Sampling Rate Range Supported by the HPADC
Clock Source Clock Frequency (Input to SCU) Supported Sampling Rate Range Over Sampling Frequency RCOSC 8.192 MHz 16 kHz to 32 kHz 2.048 MHz 1 Hz to 32.768 kHz 1 Hz to 32.768 kHz None (actual rate conversion) RTC 1 Hz to 32.768 kHz 1 Hz to 32.768 kHz None (actual rate conversion) XOSC 13 MHz 16.927 kHz to 33.854 kHz 2.167 MHz
So for my understanding it would be possible to increase the sampling rate to 2.048 MHz or 2.167 MHz without down sampling. Is that correct?
Another question is if it is possible to do it with the Arduino IDE? Could I use register manipulation or something like that? I know for example that it is faster with an Arduino UNO to use something like ADCSRA register instead of the read functions that have got some overhead. Are the registers accessible with the Arduino IDE?
Thanks in advance for your help!
On Spresense you can use sampling frequency up to 512kHz.
To achieve this please see the recommended configuration in https://developer.sony.com/develop/spresense/docs/sdk_tutorials_en.html#_adc_sampling_frequency
It is also possible to use the new configuration in the Arduino IDE. To do this you will need to create a new exported SDK. In this repository you will find instructions on how to prepare a custom Arduino package for Spresense: https://github.com/sonydevworld/spresense-arduino-compatible
Thanks to this you will be able to use your own Spresense SDK with your own ADC configuration.