I found a very strange behaviour in terms of ADS1247 SPI communication, any TWO command string must be kept sending to ADS1247within 80ms otherwise ADS1247 return rubbish, for example I send command string: 0x2b 0x00 0x00, which is to read register 0xb(IDAC1), then I get a byte 0xff which is correct default value. However If I wait for 80ms then send exactly same command string again I end up with getting 0x00 from ADS1247. If I constantly send command string within 80ms ADS1247 always returns 0xff. Is this real behaviour or something I got wrong?
The device has two modes of operation: Read data continuously (RDATAC) and Stop reading data Continuously (SDATAC). The device is by default on the RDATAC mode converting at 5SPS (200ms). When the device is in RDATAC mode, the output will provide conversion results as the first 24 SCLK's are been fed through.
It is possible that the device is in the RDATAC mode, and the device is still issuing the last byte of the conversion result when you are trying to read the register content. In order to 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 command.
Please let me know if this does not solve the issue.
Thank you and Best Regards,
Thanks for your reply. I have tried your suggestion but it still doesn't work. To clarify my problem, I list my code below(to be easier for understanding, I list pseudo code):
1. Initialise my CPU(Atmel CAN128) SPI interface as well as IOs for RESET, CS and START pins
2. RESET pin low, START pin low, CS high
3. Wait for 20ms(as requested in the datasheet)
4. RESET pin high, START pin kept low
5. CS low
6. Send command string to read register 0xb from ADS1247: 0x2b, 0x0, 0x0 // also tried command string 0x16, 0x2b, 0x0, 0x0, return a correct value, which is 0xff
7. After the last byte sent out, one byte data returned: 0xff, which has been verified that it is correct default value
8. CS high
9. Wait for 100ms, this is my application required
10. CS low //start the second register reading
11 Send the same command string as step 6, which is 0x2b, 0x0, 0x0 // also tried command string 0x16, 0x2b, 0x0, 0x0, return a incorrect value, which is 0
12 CS high.
P.S the twice try should give exactly same value 0xff however for some reasons it doesn't.
I can't find any problem from the code above. I appreciate if you can point out any issue in my code.
Finally I found answer, my revised pseudo code to read register as below:
very important to be added here: START high
6. Send command string to read register 0xb from ADS1247: 0x2b, 0x0, 0x0 // return a correct value, which is 0xff
very important to be added here: START low
problem fixed!!! but why?
The START pin can be used to control the conversions on the device. Pulsing START can be used to trigger conversions; or the START pin can be hold high to configure the device to convert continuously.
Setting the START pin low will put the device in sleep mode or power down mode. When the START pin is low, only the RDATA, RDATAC, SDATAC WAKEUP and NOP commands can be issued. You may refer to the SPI communication during sleep mode on page 37 of the datasheet.
Thank you for letting us know that the issue was resolved,
I can't get it working reliably with the way mentioned in my previous reply, sometimes it returns unexpected value.
What I'm wanting is farely simple,
1. get rid of sleep mode or something like power down mode, I just like the chip to work as normal
2. set IDAC to 250uA to AIN0 and AIN1
3. 5 SPS
4. GAIN 128
5. just using standard SPI interface, i.e. CS SCLK, SDO and SDI, do NOT use any other pins like START, RESET, DRDY
how should I do?
I recommend placing 10k or 100k pull up resistors on the RESET pin and the START pin so they always default high. The device offers a RESET SPI command, however, I personally always prefer to assign a GPIO to control the RESET pin, since this may allow a more robust solution. With the START and RESET pins pulled high, the device will power up in the default condition in RDATAC mode, PGA=1, data rate 5SPS, AIN0 to positive input, AIN1 to negative input, Internal Reference off and IDACs off.
- After the device supplies has been powered up and the controller has been initialized:
1) Toggle the RESET pin low, and Release RESET high
2) Issue a WREG command to write the MUX1 register to turn on the internal 2.048V reference; enable the onboard reference for conversion; and to write the SYS0 register to set the device to PGA=128, 5SPS:
(Note: In order to use the IDAC's; the internal reference must be tuned on; in this example the internal reference is turned on and also used for conversions)
3) Issue a WREG to configure the IDAC0 and IDAC1 registers: 250uA IDAC1 to AIN0 and the second IDAC2 to AIN1
4) If you want to read the registers, issue a Stop Data Continuous command first; so the conversion results are not mixed with the register values
5) For example, if you want to read the IDAC0 and IDAC1 registers;
The device should return the IDAC0 and IDAC1 registers values. Of course, you will need to set the CS pin low while the SPI commands are issued.
If you continue to have issues, please provide oscilloscope shots of the CS, DIN, DOUT, SCLK pins while issuing WREG and RREG commands.
It's working now!
Many thanks for your help.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.