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.
Hello,
I want to interface to the ADS1298 in an university project and i am not getting anything from DOUT nor DIN. These are my specifications:
uC -> 4MHz crystal input to 48MHz with PLL
ADS1298 -> 250SPS
LOW_POWER
nCS = 0 -> chip select low
nPowerDown = 1
nReset = 1
delay 1 second
nReset = 0
delay 1 us
nReset = 1
delay 10 us
Start = 1;
delay 18 ms
aux = SSP2BUF;
SSP2BUF = SDATAC; // 0x11; // SDATAC
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0x41; // WREG 01h
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0x03; // register to write: 3
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00100110; // low power 250hz
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010100;
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b11000000;
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0x45; // WREG 05h
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0x08; // registers to write: 8 (gain)
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 1
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 2
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 3
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 4
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 5
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 6
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 7
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 8
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0x10; // Enable RDATAC mode
while(!SSP2STATbits.BF);
aux = SSP2BUF;
delay
nCS = 1;
Here are some screeen shots flom de oscilloscope:
There you can see the data ready signal (red). i interrupt the micro in the falling edge. Below, the clock signal (yellow) from the SPI module.
Here yo can see in red the clock signal and in yellow the chip select signal. I set it low duting the transmition.
And finally the DIN (red) and DOUT (yellow). Nothing comes in nor out of the spi module.
Do you have any suggestion?
What could be causing not to have anything in DIN or DOUT?
Does DIN and DOUT need any pull up resistors?
Am i missing anything?
Thanks in advance!!!
Hi Juan,
I think the problem is how you set the registers. If you want to write n registers, you need to send n-1 as parameter.
See comment (2) under table 11 on page 37 in the datasheet. I suppose that will solve the problem ;-)
a general note: pease note that the CS/ does not totally disable the SPI interface of the ADS1298. So, the SPI bus is not a real bus. This only matters if you use more than one device at this bus. That said, note the minimum timing requirements, for instance the 17us you need to wait from pulling CS/ low to the first clock pulse. Maybe its better to keep CS/ low the whole time for testing.
DIN is an input. It needs to be held low while reading data, unless you want to write a command or data to the chip while reading at the same time.
Best,
Bernhard
Thak you very much for your answer. The problem i was getting was a hardware problem so thats why i was not getting any output but your observations were very good =). Now i held CS always low and i modified the configuration registers. Do you mean something like this:
aux = SSP2BUF;
SSP2BUF = SDATAC; // 0x11; // SDATAC
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0x41; // WREG 01h
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0x02; // 3 registers
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00100110; // LP @250hz
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010100;
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b11000000;
while(!SSP2STATbits.BF);
aux = SSP2BUF;
// Configuracion de ganancias
SSP2BUF = 0x45; // WREG 05h
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0x07; // 8 registers
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 1
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 2
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 3
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 4
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 5
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 6
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 7
while(!SSP2STATbits.BF);
aux = SSP2BUF;
SSP2BUF = 0b00010000; // Canal 8
while(!SSP2STATbits.BF);
aux = SSP2BUF;
Thanks in advance!!
Juan
Hi Juan,
yes, this should work! At least this register setting will work now. I was stuck in exactly the same problem for days, until a person from TI pointed me to that n-1 problem ;-)
Bernhard
Thanks for the answer =).
Do the registers configures even if there is something wrong with the DOUT line? I still can not see DOUT. I thought the problem was the hardware but i still not seen DOUT.
Due the fact that I am seeing DRDY and the SPI clock, what else should I test? or what other configuration should I try?
Thanks in advance!!