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.


Other Parts Discussed in Thread: ADS1246

I am workign with  ADS1246 data converter. Powering up the chip and using SPI bus I am able to read A2D data. I assume the defult register values allow the converstion take place and I do get reasonable conversition. I would like to write to SYS0 register, so that sampling rate is set to 160sps. I am having trouble with RREG and WREG commands though.   I am using Table 22's commands, however the wrting or reading part  when it comes to registers don't work.   I have tried different vlaues, yet,  when I read SYS0 register back I get 0. Your feedback and comments will be much appreciated.  My code follows. 



spi.write(0x43); // first command: write register SYS0 - address 03h
spi.write(0x00); // second command byte: 0000_nnnn (n is number bytes -1)
spi.write(0x05); // sys0: gain = 1 and 160sps
SYS0_reg1 = spi.write(0x23); // read register SYS0 - address 03h
SYS0_reg2 = spi.write(0x00);
pc.printf("sys0 regiter1 = 0x%X \n\r", SYS0_reg1);
pc.printf("sys0 regiter2 = 0x%X \n\r", SYS0_reg2);
bcs_reg = spi.write(0x00);
spi.write(0x20); // read register BCS - address 00h
bcs_reg = spi.write(0x00);
pc.printf(" BCS contains = 0x%X \n\r", bcs_reg);

START1 = 1;
Va2d = Vcalculation();
pc.printf(" V= %f \r\n", Va2d);
START1 = 0;


  • Hello Hamid,

    The ADS1246 device has two modes of operation: Read data continuously (RDATAC) and Stop reading data Continuously (SDATAC). 

    When the device is powered up with the START pin high and the RESET pin held high, the device is by default on the RDATAC mode converting at 5SPS (200ms).  When the device is in RDATAC mode, the DOUT output will provide conversion results as the first 24 SCLK's are been fed through. The RESET and START pins must be held high while issuing the RREG and WREG commands.  In order to be able to read register values, and avoid issues where the conversion results are being mixed with register values, you may issue first a SDATAC command (x16h) and then issue the RREG (x2300XXh) command when trying to read the SYS0 register.   

    Notice also that the Read operation is similar to the WREG operation.  The RREG is at least 3 bytes long where:

    1st RREG Command byte is 0010 rrrr where rrrr is the address;

    2nd Command byte is 0000 nnnn; where nnnn is the number of bytes -1

    3rd Byte and above:  Send NOP/dummy byte(s) to read register Data contents..

    In the code above, it appears you are missing the third NOP/dummy byte to read the register contents (?)

    After you have successfully read the register values, you may read the output conversion data by command (Issue RDATA x12h command) or configure the device back into the default Read Data Continuously mode by issuing the RDATAC command (x14h).  The RDATAC and SDATAC modes of operation are described on page 51 of the datasheet.

    Thank you and Best Regards,