I am using an external TI ADS 8675 14bit ADC. This ADC should be capable of sampling rates up to 500k/s. I'm only getting around 80. Which isn't too shabby, but I need at least double that. More would be more. I'm using the Arduino IDE. Below are the key portions of my code. Nothing is going on in any interrupts that would slow things down. The timing between readings is reliably 12 microseconds.
The ADS8675 can handle a max SPI clock of 66MHz. The pico can handle 62.5MHz. That's what we're going with.
Am I maxing out the abilities of the pico? It doesn't seem so, but I'm no expert.
The ADS8675 can handle a max SPI clock of 66MHz. The pico can handle 62.5MHz. That's what we're going with.
Code:
#include <SPI.h>// ADS8675 SPI settingsSPISettings adcSettings(62500000, MSBFIRST, SPI_MODE0);[...]loop (){ uint16_t readings[512]={0}; uint16_t times[512]={0}; uint32_t startMicros = micros(); for (uint16_t i =0; i < 512; i++) { readings[i] = readADC(); times[i] = micros()-startMicros; } Serial.println("micros,reading"); for (uint16_t i =0; i < 512; i++) { Serial.print(times[i],DEC); Serial.print(","); Serial.println(readings[i]); }}uint16_t readADC() { uint8_t transBuff [4]= {0xFF}; uint32_t adcRead=0x00000000; digitalWrite(adcSelectPin,LOW); SPI.beginTransaction(adcSettings); SPI.transfer(transBuff,4); SPI.endTransaction(); digitalWrite(adcSelectPin,HIGH); adcRead = adcRead | transBuff[1] ; adcRead = adcRead | (transBuff[0] << 8); adcRead = adcRead >> 2; return adcRead;}
Statistics: Posted by stst — Fri Apr 05, 2024 6:06 pm — Replies 3 — Views 60