This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I can't figure out why i'm not getting any data back from the chip... Sadly, i do not have an oscilloscope to help me debug. I tried a lot of combination without success but here is my latest code failing code. I don't know what else to do...
PS: I tried Manual, Auto-1 and Auto-2 without any success.
#include <SPI.h> auto ADC_CLK = 1000000; //Pins for Arduino MEGA #define mosi 51 #define miso 50 #define cs 53 #define clk 52 //unsigned int cmd_1 = 0x4200; //unsigned int cmd_2 = 0x8000; //unsigned int cmd_3 = 0xFFFF; //unsigned int cmd_4 = 0x2C00; //unsigned int cmd_5 = 0x2840; //unsigned int cmd_6 = 0x0000; //unsigned int cmd_1 = 0x4200; //unsigned int cmd_2 = 0x3C00; //unsigned int cmd_3 = 0x93C0; //unsigned int cmd_4 = 0x3800; //unsigned int cmd_5 = 0x3800; //unsigned int cmd_6 = 0x0000; //unsigned int cmd_7 = 0x1840; unsigned int cmd_1 = 0x8400; // 1000 0100 0000 0000 unsigned int cmd_2 = 0x91C0; // 1001 0001 1100 0000 unsigned int cmd_3 = 0x0000; // 0000 0000 0000 0000 void setup() { Serial.begin(115200); pinMode(cs, OUTPUT); delay(1000); ADS7953_setup(); Serial.println("Setup complete"); } void loop() { Serial.print("Received Data : "); Serial.println(ADS7953_Call(0x0000)); delay(500); } void ADS7953_setup() { digitalWrite(cs, HIGH); delay(5); /* Reset Command */ Serial.print("Command #1 : "); Serial.println(ADS7953_Call(cmd_1)); Serial.print("Command #2 : "); Serial.println(ADS7953_Call(cmd_2)); Serial.print("Command #3 : "); Serial.println(ADS7953_Call(cmd_3)); // Serial.print("Command #4 : "); // Serial.println(ADS7953_Call(cmd_4)); // // Serial.print("Command #5 : "); // Serial.println(ADS7953_Call(cmd_5)); // // Serial.print("Command #6 : "); // Serial.println(ADS7953_Call(cmd_6)); } unsigned int ADS7953_Call(unsigned int Commande) { SPI.beginTransaction(SPISettings(ADC_CLK, MSBFIRST, SPI_MODE0)); digitalWrite(cs, LOW); unsigned int Received_data = SPI.transfer(Commande); digitalWrite(cs, HIGH); SPI.endTransaction(); delay(100); return Received_data; }
Hello,
I strongly suggest getting a hold of an oscilloscope, or a logic analyzer that can help to visually inspect what the code is in fact doing. This will also help that timing is correct. Debugging code without any visual is rather difficult.
I suggest sticking with only one mode, manual, once that is working, then you can move on to the different auto modes. the auto modes require more digital communication, and if that is not established it is harder to successfully use these modes.
In manual mode, you select what channel to sample, thus you can immediately see what the device response is. use one channel, and use a known DC input, this will help to compare the expected result to the measured output. Note that this device has a three frame latency to get the measured output.
Try the below demands, and see if the output is correct. Connect a known DC input within x1 range of the device (ie 1V)
1000xh, 1000xh, 1000xh
This will run the device in manual, sample channel 0, and the output will display the channel that was sampled in the first four bits of the output. the third frame should result in something near 0666xh (if the input was 1V)
if this works, then now try sampling different channels. be sure to have different known DC inputs at each channel, example Ch0 = 1V, channel 1 =2V)
try: 1000xh, 1080xh, 1000xh, 1000xh
Here the third frame will have channel 0 response (0666xh for 1V) and the fourth frame will have 1CCDxh
Regards
Cynthia
Thanks for the fast reply!
Sadly, i didn't got it to work... I'll post the code here if i ever find a solution.
I would have thought that i could have found a library for this kind of chip for the Arduino. Are you aware of any?
Hello,
If the commands i provided still do not work, then I suspect it is not the ADC. An oscilloscope would really be beneficial here, as you cannot confirm what your code is actually doing.
That team would know better, i suggest posting a new question with the micro part in the title, and they will answer your question. also, you can look at community forums.
Regards
Cynthia