Hello,
I have a really strange problem with my custom board (ADS1299 + Atmel SAMD21G18A): sometimes ADS1299 gives corrupted data, either from one channel, or from several channels.
My ADS1299 is working in single-shot mode, with internal 2.048MHz clock. The microcontroller sends START command at a frequency of 2000Hz, it waits for ADS1299 DRDY interrupt, then reads ADS1299 buffer. The ADS1299 sends data to the microcontroller via SPI (SPI baud rate 4M, ADS1299 SPS = 16k). ADS1299 channel 1 - channel 4 for EEG data acquisition, channel 5 - channel 8 off.
I should mention that there is a small delay (~3us) in my code between ADS1299 DRDY and the start of microcontroller reading.
Below shows one example. As no electrodes are connected, I am supposed to get 7FFFFFh all the time. However, as you can see from the screenshot, some data got corrupted.
I connected a logic analyzer to the ADS1299 SPI pins, and this confirms the corruption of data before they are sent to the SPI line. Below shows an example (here channel1 data is corrupted):
The strange thing is, when I delete my delay (meaning that the microcontroller waits infinitely DRDY signal and launches read operation as soon as ADS1299 data is ready), this bug seems disappeared and I got stable data.
I tested with ADS1299 internal test signals (square waves), I changed SPI speed, same problem.
I found a similar post here: https://openbci.com/forum/index.php?p=/discussion/423/ads1299-with-arduino-due-sampling-problem
Could someone explain what I am doing wrong?
Thank you very much.
Kind regards
Xin