Hello everyone,
I’m currently working on a part of a big project that requires me to read the converted digital signals from an ADC (ADS8354 - https://www.ti.com/lit/ds/symlink/ads8354.pdf ). I know the Teensy 4.1 has a 12-bit ADC feature but the project requires a resolution of 16-bit which is why I’m opting to use the ADS8354. The issue I’m facing right now is that I’m only able to get values of 1 as output. I’m writing a simple sketch to get the converted digital values and printing out the 16-bit values on the serial monitor (which I’ve attached below). I’m not sure if there’s an issue with my code, SPI setting, ADC settings or the wiring of my ADC.
I’ve been able to use the decode function on my oscilloscope to see the MISO line from the ADC to the Teesny and I’m able to see some HEX values. Not sure if those are the correct values just yet though.
I suspected that the issue might be because the Teensy 4.1 is too fast for the ADC but I also tried adding some delays in my code and even using a Teensy 3.2 but I’m still facing the same issue.
I also tried using SPI_MODE1 but that still didn’t fix my issue.
These are my current pin assignments:
CS on the ADC = pin 10 on teensy
SCLK on ADC = pin 13 on teensy
SDI on ADC = pin 11 on teensy
SDO on ADC = pin 12 on teensy
GND on ADC = GND on teensy
Arduino code:
#include <SPI.h>
const int CS_PIN = 10; // Chip Select pin for the ADC
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Initialize SPI
SPI.begin();
SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE3));
pinMode(CS_PIN, OUTPUT);
digitalWrite(CS_PIN, HIGH);
uint16_t config_command = 0x8040; // Configure the ADS8354 for full range +-Vref and internal reference
digitalWrite(CS_PIN, LOW);
SPI.transfer16(config_command);
digitalWrite(CS_PIN, HIGH);
}
void loop() {
// Read the converted data
digitalWrite(CS_PIN, LOW);
uint16_t adc_data = SPI.transfer16(0x0000);
digitalWrite(CS_PIN, HIGH);
Serial.print("ADC Raw: ");
Serial.println(adc_data, HEX);
// Add a small delay to avoid overwhelming the serial monitor
delay(100);
}
Output:
ADC Raw: 1
ADC Raw: 1
ADC Raw: 1
ADC Raw: 1
ADC Raw: 1
ADC Raw: 1
.
.
.
ADC Raw: 1
this is a graph of the differential input that I'm trying to convert:
I’m currently working on a part of a big project that requires me to read the converted digital signals from an ADC (ADS8354 - https://www.ti.com/lit/ds/symlink/ads8354.pdf ). I know the Teensy 4.1 has a 12-bit ADC feature but the project requires a resolution of 16-bit which is why I’m opting to use the ADS8354. The issue I’m facing right now is that I’m only able to get values of 1 as output. I’m writing a simple sketch to get the converted digital values and printing out the 16-bit values on the serial monitor (which I’ve attached below). I’m not sure if there’s an issue with my code, SPI setting, ADC settings or the wiring of my ADC.
I’ve been able to use the decode function on my oscilloscope to see the MISO line from the ADC to the Teesny and I’m able to see some HEX values. Not sure if those are the correct values just yet though.
I suspected that the issue might be because the Teensy 4.1 is too fast for the ADC but I also tried adding some delays in my code and even using a Teensy 3.2 but I’m still facing the same issue.
I also tried using SPI_MODE1 but that still didn’t fix my issue.
These are my current pin assignments:
CS on the ADC = pin 10 on teensy
SCLK on ADC = pin 13 on teensy
SDI on ADC = pin 11 on teensy
SDO on ADC = pin 12 on teensy
GND on ADC = GND on teensy
Arduino code:
#include <SPI.h>
const int CS_PIN = 10; // Chip Select pin for the ADC
void setup() {
// Initialize serial communication
Serial.begin(9600);
// Initialize SPI
SPI.begin();
SPI.beginTransaction(SPISettings(20000000, MSBFIRST, SPI_MODE3));
pinMode(CS_PIN, OUTPUT);
digitalWrite(CS_PIN, HIGH);
uint16_t config_command = 0x8040; // Configure the ADS8354 for full range +-Vref and internal reference
digitalWrite(CS_PIN, LOW);
SPI.transfer16(config_command);
digitalWrite(CS_PIN, HIGH);
}
void loop() {
// Read the converted data
digitalWrite(CS_PIN, LOW);
uint16_t adc_data = SPI.transfer16(0x0000);
digitalWrite(CS_PIN, HIGH);
Serial.print("ADC Raw: ");
Serial.println(adc_data, HEX);
// Add a small delay to avoid overwhelming the serial monitor
delay(100);
}
Output:
ADC Raw: 1
ADC Raw: 1
ADC Raw: 1
ADC Raw: 1
ADC Raw: 1
ADC Raw: 1
.
.
.
ADC Raw: 1
this is a graph of the differential input that I'm trying to convert: