Quantcast
Channel: Data converters
Viewing all articles
Browse latest Browse all 90419

Forum Post: ADS124S08: Device Ready Flag (!RDY) high after RESET command

$
0
0
Part Number: ADS124S08 Tool/software: Hi, I'm following the pseudo-code example from the datasheet (10.1.6, pg. 90) but when I send the RESET command and then read the status register (using the RREG command) to check the device ready flag it always comes back as 1. Before sending the RESET command it was 0 (as it should be). I've tried with bigger delays and/or different SPI speeds but it is always the same result. I've also tried other libraries and the result is the same. I don't know if I'm misunderstanding something or if I'm doing something wrong. Here is the code library: // C++ #include "PUADS124S08.h" void PUADS124S08::deselect() { digitalWrite(cs, HIGH); SPI.endTransaction(); // Wait >~20ns asm ( "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" ); } void PUADS124S08::select() { SPI.beginTransaction(spisett); digitalWrite(cs, LOW); // TODO: Wait 4096 * (1 / freq) asm ( "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" "nop" "\n" ); } PUADS124S08::PUADS124S08(int cs) : cs(cs) { pinMode(cs, OUTPUT); deselect(); } bool PUADS124S08::reset() { select(); SPI.transfer(Commands::RESET); deselect(); delayMicroseconds(100); if (!isready()) { return false; } // TODO: FL_POR flag return true; } bool PUADS124S08::isready() { uint8_t byte = readb(Registers::STATUS); #ifdef DEBUG Serial.println(millis()); Serial.print("Status register: "); Serial.print("0b"); Serial.print(byte, BIN); Serial.println(); #endif return !(byte & 0b01000000); } uint8_t PUADS124S08::readb(uint8_t adrr) { uint8_t com = Commands::RREG | (adrr & 0b00011111); uint8_t r; select(); SPI.transfer(com); SPI.transfer(0x00); r = SPI.transfer(0x00); deselect(); return r; } main: (codeblock not working) ```cpp // main.cpp #include #include #define MISO 16 #define MOSI 19 PUADS124S08 adc1; void setup() { delay(3000); pinMode(MISO, INPUT); pinMode(MOSI, OUTPUT); Serial.begin(115200); SPI.begin(); adc1 = PUADS124S08(15); Serial.println(adc1.isready()); // adc1.reset(); while (!adc1.reset()) { Serial.println("Error"); delay(1000); } Serial.println("ADC Init"); while(1); } ``` // main.cpp #include #include #define MISO 16 #define MOSI 19 PUADS124S08 adc1; void setup() { delay(3000); pinMode(MISO, INPUT); pinMode(MOSI, OUTPUT); Serial.begin(115200); SPI.begin(); adc1 = PUADS124S08(15); Serial.println(adc1.isready()); // adc1.reset(); while (!adc1.reset()) { Serial.println("Error"); delay(1000); } Serial.println("ADC Init"); while(1); } serial: 740063 Status register: 0b11000000 Error ... 740231 Status register: 0b11000000 Error Logic Analyzer RESET: RREG: then I send 0x00 and 0x00 again to read the MISO: Electric diagram: Also I'm using a raspberry pi pico (rp2040) with the Arduino framework Any help would be greatly appreciated Thanks

Viewing all articles
Browse latest Browse all 90419

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>