SOLVED ADC stops working at small delays (MCP3464)

Hi everyone,

I have tried debugging for a couple days with no luck, so this question is a cry for help.

I am trying to configure an external ADC (MCP3464 datasheet). The ADC uses SPI communication and I am getting a response from it when I set the delay to 1000ms. If I lower this below 100ms, the ADC does not update and prints the last value stored in the ADC register.

Here is the relevant part of the code, although I have attached the whole file in case you would like to check command bytes etc.

void adcSimple(){

    unsigned char convStatus;
    uint16_t adcData;    
    // chip Select pin LOW to read/write to ADC
    convStatus = SPI.transfer(readConversionData);
    // extracts remaing bytes and append to adcData 16 bit integer (15bits plus sign)
    adcData = SPI.transfer(0);
    adcData <<= 8;
    adcData |= SPI.transfer(0);
    // chip select pin hgih to stop read/write to ADC
    digitalWrite(adcChipSelectPin, HIGH);
    // start next conversion
    writeData(&startConversionFastCmd, 1);

void setup(){
  while (! Serial); 
  // set ADC Multiplexer to channel 0 
  writeData(&muxRegisters[0][0], 2);

void loop(){

type or paste code here

The adcSimple() function reads the ADC register address and appends it to the 16 bit adcData variable.

writeData(&startConversionFastCmd, 1);

The line above then restarts the ADC conversion (not the whole device) which is required to update the ADC register. For some reason this does not update the ADC register when there is insufficient delay in the loop.

  // Check the data ready bit
  if ((convStatus & 0x04) == 0x04)
     Serial.println("ADC not ready!!!");


I have run a test on convStatus, and this shows the ADC is not ready when the delay is short (around 100ms). I just don't understand why it takes so long (1000ms is equivalent to light years when running on 6MHz clock!)

Any suggestions would be greatly appreciated. Maybe someone has had a similar problem before?

I have no experience with such peripherals. In the datasheet it says 'Data Rate' is programmed and from TABLE 5-6 it can be seen the slowest data rate is 12.5Hz, which is 80 milliseconds. Is your sampling rate set?

'Light year' is measure of distance, not time. Just saying.

SOLVED!!! I lowered the oversampling rate (See table 5-6 of datasheet) and thus increased the data rate.

Flashko, you're a legend!

This is good. Wishing success with the project.