Hi,
I have been working with ADS1292R for several weeks but still cannot get it to work.
The problem is that, no matter what I try, registers can be written (as far as I can tell) but no read. Hardware connections have been double checked, two identical PCBs were assembled with same results and different SPI configurations have been tested.
Did anyone experience the same problem? Do you have any troubleshooting suggestions?
Can you find the cause for this on the below code, SPI configuration or schematics that I am using?
- ADS1292R is connected to a PIC32MX250F128B.
- SPI configuration: Idle state for clock is a low level, serial output data changes on transition from Idle clock state to active clock state and input data sampled at middle of data output time (CKP=CKE=SMP=0); SCLK freq.: 1MHz.
- Register write code:
SPI1CONbits.ON = 1; // SPI module on
PORTBbits.RB15 = 0; // CS low
SPI1BUF = ReceivedDataBuffer[1]; // WREG OPCODE1, say 0x42
while(SPI1STATbits.SPIBUSY);
SPI1BUF = 0x00; // WREG OPCODE2
while(SPI1STATbits.SPIBUSY);
SPI1BUF = ReceivedDataBuffer[2]; // REG DATA, say 0x88
while(SPI1STATbits.SPIBUSY);
ShortDelay(140); // approx. 4T_clk delay
PORTBbits.RB15 = 1; // CS high
SPI1CONbits.ON = 0; // SPI module off
- Register read code:
SPI1CONbits.ON = 1; // SPI module on
PORTBbits.RB15 = 0; // CS low
SPI1BUF = ReceivedDataBuffer[1]; // RREG OPCODE1, say 0x20
while(SPI1STATbits.SPIBUSY);
SPI1BUF = 0x00; // RREG OPCODE2
while(SPI1STATbits.SPIBUSY);
SPI1BUF = 0x00; // MOSI low during data reading
while(SPI1STATbits.SPIBUSY);
ToSendDataBuffer[1] = SPI1BUF; // REG DATA
ShortDelay(140); //approx. 4T_clk delay
PORTBbits.RB15 = 1; // CS high
SPI1CONbits.ON = 0; // SPI module off
- ADS1292R schematics is as follows:
- For example, by sending first a RESET command (0x06), I can write 0x01 or 0x02 to GPIO and read the corresponding levels on GPIO1/2 pins. Or I can also write 0x88 to CONFIG2 and then read 512.9KHz on CLK pin, this is how it looks like:
- But, whenever I try to read a register (anyone) always read 0x00
- Also checked DOUT pin disconnected from the PIC32 MISO pin (with the logic analyzer), to rule out problems caused by the microcontroller, but it's the same: DOUT remains low for the entire transaction.
At this point I am just keeping my fingers crossed to make this work :-)
Thanks in advance for your time and suggestions!
Esteban