Trying using ADC122S101 chip with ADC08XS.h library, Issue is that no address sending from Teensy4.1, MOSI, to the chip.
There is 2 channel on it and all time getting the data just from first channel.
With sketch that I use just spi.h library with Teensy4.1 it seems that data sending out.
Arduino library for ADC08XS ADC (SPI).
What should be changed to get it to work with the library.
#include <SPI.h>
const int SS_PIN = 10; // Replace with your SS pin
const int SPI_MOSI = 11;
const int SPI_MISO = 12;
const int SPI_SCK = 13;
const int RST_PIN = 22;
void setup() {
pinMode(SS_PIN, OUTPUT);
digitalWrite(SS_PIN, HIGH);
SPI.begin();
pinMode(RST_PIN, OUTPUT); //OUTPUT_OPENDRAIN
digitalWrite(RST_PIN, LOW);
}
void loop() {
digitalWrite(RST_PIN, HIGH);
delay(2);
digitalWrite(RST_PIN, LOW);
delay(2);
digitalWrite(RST_PIN, HIGH);
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(SS_PIN, LOW); // Select device
SPI.transfer(0x08); // Send address
uint16_t data = SPI.transfer(0x08) << 8; // Read data
digitalWrite(SS_PIN, HIGH); // Deselect device
// Do something with the received data
Serial.println(data, DEC); // Print data in hexadecimal format
digitalWrite(RST_PIN, LOW);
delay(100); // Optional delay for testing
}
There is 2 channel on it and all time getting the data just from first channel.
With sketch that I use just spi.h library with Teensy4.1 it seems that data sending out.
Arduino library for ADC08XS ADC (SPI).
What should be changed to get it to work with the library.
#include <SPI.h>
const int SS_PIN = 10; // Replace with your SS pin
const int SPI_MOSI = 11;
const int SPI_MISO = 12;
const int SPI_SCK = 13;
const int RST_PIN = 22;
void setup() {
pinMode(SS_PIN, OUTPUT);
digitalWrite(SS_PIN, HIGH);
SPI.begin();
pinMode(RST_PIN, OUTPUT); //OUTPUT_OPENDRAIN
digitalWrite(RST_PIN, LOW);
}
void loop() {
digitalWrite(RST_PIN, HIGH);
delay(2);
digitalWrite(RST_PIN, LOW);
delay(2);
digitalWrite(RST_PIN, HIGH);
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE3));
digitalWrite(SS_PIN, LOW); // Select device
SPI.transfer(0x08); // Send address
uint16_t data = SPI.transfer(0x08) << 8; // Read data
digitalWrite(SS_PIN, HIGH); // Deselect device
// Do something with the received data
Serial.println(data, DEC); // Print data in hexadecimal format
digitalWrite(RST_PIN, LOW);
delay(100); // Optional delay for testing
}