Part Number: ADS1292R
Hi,
I've been trying to read any kind of data on Dout pin from my ADS1292r and it seems like I don't have any idea what is going on.
I've been trying to read ID register on 0x00 location. Can u please have a quick look and try to find what am I doing wrong?
Code is compiled and i can get SCLK, DIN and CS_ working properly, ie. I'm getting sclk and DIN on oscilloscope when "send_command" is
I am using pic24fj64ga104 and only want to read status register at the begining.
Pic SCLK = 1MHz
disclaimer - This is code not inspired all by me!
void initADS1292(){
inCodeDelayMs(500);//delay miliseconds
inCodeDelayMs(500);
ADS_CLKSEL = 1; //iternal clock
//reset ADS1292
ADS_RESET_OFF;
inCodeDelayMs(500);
inCodeDelayMs(500);
ADS_RESET_ON;
inCodeDelayMs(500);
inCodeDelayMs(500);
ADS_RESET_OFF;
inCodeDelayMs(500);
CS_SELECT;
inCodeDelayMs(500);
inCodeDelayMs(500);
CS_DESELECT;
inCodeDelayMs(500);
//Send SDATAC command (Stop read data continuosly mode)
send_command(SDATAC); // #define SDATAC 0x11
inCodeDelayMs(1);
inCodeDelayMs(5);
read_byte(0x00);// read status reg
int read_byte (int reg_addr) {
int out=0;
CS_SELECT; // CS pin = 1
WriteSPI1 (0x20 | reg_addr);
TTG_inCodeDelayMs(1);
WriteSPI1 (0x00); //number of registers to be read/written -1
TTG_inCodeDelayMs(1);
out = ReadSPI1();
TTG_inCodeDelayMs(1);
CS_DESELECT;//CS pin=0
return (out);
}
void send_command(uint8_t cmd) {
CS_SELECT;
TTG_inCodeDelayMs(2);
WriteSPI1 (cmd);
TTG_inCodeDelayMs(2);
CS_DESELECT;
}