3
\$\begingroup\$

I am using an MCP3561 ADC (Datasheet) to convert analog readings from a load cell to digital signals to be processed by an ATSAMD20G16 Microcontroller (Datasheet). I have configured the ADC to exhibit the following properties:

Prescaler: 2
Oversampling Rate: 98304
Gain:1
Continuous Conversion

This corresponds to a sampling interval of approximately 100ms given Equation 4.3 on page 27 of the ADC datasheet and an 8 MHz master clock from the MCU. My application continuously polls the IRQ register on the ADC to check the !DR_STATUS bit. When this bit indicates data is ready, the program reads the contents of the ADC's data register and transfers it to the MCU over SPI.

I have configured my main loop to print the value of the ADC read and the time interval between reads over the serial port. I observe a consistent 98-99ms interval between samples. Occasionally, however, the inter-sample interval is doubled. The occurrence of this doubling is unpredictable; sometimes there is a cluster of double intervals in rapid succession, other times it takes 20 or 30 seconds before a double interval occurs.

I edited my ADC read function to toggle a GPIO pin on the MCU every time it reads a sample so I could correlate the serial output to a signal on the oscilloscope. Then I stripped every piece of extraneous code from my main loop, including the serial print statements, with the hopes of isolating the cause of this anomoly. Unfortunately, the behavior persisted, and I am no closer to an answer.

Has anyone experienced this behavior (or anything similar) when using this IC? If so, were you able to determine the cause/develop a solution? Any insight would be appreciated!

Thanks in advance!

\$\endgroup\$
2
  • \$\begingroup\$ Can't you use the IRQ pin so you don't have to poll? How are you doing the polling? Post the code and schematics for reference how to fix this. \$\endgroup\$
    – Justme
    Commented Nov 12, 2020 at 21:16
  • \$\begingroup\$ Could the SAM be getting hung up on some other interrupt? \$\endgroup\$
    – rdtsc
    Commented Nov 12, 2020 at 21:18

1 Answer 1

5
\$\begingroup\$

Voice of (painful) experience: when using Microchip products, always check out the errata sheet. Your issue and a workaround are described in http://ww1.microchip.com/downloads/en/DeviceDoc/MCP3X5X-Family-Data-Sheet-Errata-DS80000845B.pdf .

\$\endgroup\$
1
  • \$\begingroup\$ Thank you so much! This is very helpful. \$\endgroup\$
    – DFunke
    Commented Nov 13, 2020 at 12:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.