Hi,
What a incomplete ADS1118 datasheet!
Anyway using the ADS1118 for the first time so to begin with a single shot mode temperature read out.
The readout of code snippet below is:
ADS1118: 00,00,3d,93ADS1118: 0c,24,3d,93
0C24 hex converts to 24.3 degrees celcius which is the temperature within given accuracy.
My question is:
The first readout of the CnfReg is 0x3D93: OS=0 and Cnv_rdy=1: makes sense. The second readout I would expect OS to be '1' and Cnv_rdy=0 thus ready BD92. Instead I read 3D93.
What is going wrong?
Regards,Edwin.
Code snippet:
output_low(En_Spi_ADS1118); i80 = spi_read(0xBD); //start conversion, mux011, PGA101, single shot i81 = spi_read(0x92); //rate 128SPS, TEMP, NoPull, valid data i82 = spi_read(0); i83 = spi_read(0); output_high(En_Spi_ADS1118); delay_ms(5); //try to read a non zero b15 output_low(En_Spi_ADS1118); i80 = spi_read(0); i81 = spi_read(0); i82 = spi_read(0); i83 = spi_read(0); output_high(En_Spi_ADS1118); fprintf(debug, "ADS1118: %x,%x,%x,%x\n",i80,i81,i82,i83); output_low(En_Spi_ADS1118); i80 = spi_read(0); i81 = spi_read(0); i82 = spi_read(0); i83 = spi_read(0); output_high(En_Spi_ADS1118); fprintf(debug, "ADS1118: %x,%x,%x,%x\n",i80,i81,i82,i83);
Hello Edwin,
I apologize for the ADS1118 data sheet troubles. We realize that there is a problem in the configuration register description and we are in the process of correcting it.
When reading the value of the configuration register, Bit[15] (OS bit) should always read ‘0’ and when reading the Config register value of Bit[0] (CNV_RDY_FL ) should always read ‘1’. Therefore, when reading the Configuration Register, the user should always read:
‘0xxx xxxx xxxx x011’
Where:
Bit 15 is the OS bit; You can write '1' to this register to begin a single conversion, however, the read status yields always a '0".
Bit [0] CONV_RDY_FL should always read "1"; Bits[2:1] NOP registers should always read '01" or valid data. The configuration register should always end in '011'.. So I believe you are reading the configuration register correctly.
When using the device in single-shot mode, after reading the config register (Config LSB always=1); the DOUT will transition low when the data is ready. If CS is held low, the DOUT/DRDY asserts low indicating new data. After trigerring a conversion, you may monitor the status of the DOUT pin to know if the conversion result is ready or wait a delay according to the programmed data rate to read the conversion result.
Thank you for the feedback,
Best Regards,
Luis
Hi Luis,
Thanks for the swift response. I think it is more a silicon error that datasheet. An ADC converter which has a non-working conversion busy/ready bits? Strikes me oblivious. Someone has been sleeping
Anyway, i'll try to deal with this situation and test the presented solution.
I do have some other questions which are not answered in the datasheet.
* Converter power-up:
- are there special precaution apply power-supply to the chip?
- how long does it take before the converter is ready for action ?
* System performance
- nonlinearity is specified at 8SPS; what about 860SPS? Far worse?
Edwin
Hi Edwin,
As most A to D converters, it is recommended to use bypass capacitors in close proximity to the device supply pin. The datasheet recommends 0.1uF capacitors. This capacitor may help attenuate noise present in the supply and also helps to provide for current bursts needed when the device is converting. The other general precaution is to not drive the voltage supply (or any of the pins) above 5.5V from GND. .
At power up, the device is by default in power down state mode where the PWDN bit in the config register is set to '1'. Provided the AVDD pin is already settled in the operating voltage range, the user could start a conversion by writing the configuration register. The serial interface timing requirements are given in figure 1.
Figure 13, on page 8 of the datasheet shows the INL performance of the device vs data rate. The INL error distribution is typically less than 8ppm at 860SPS.
Bypass cap is of course taken care of. For now the internal temperature sensor can be read. In the near future a lot more needs to be done with this converter. We are going to use it in series production.
- What is the roadmap for this converter in fixing this silicon bug?
Regards,Edwin
Edwin,
This is not a silicon bug....the device works as designed. The problem is strictly in regards to the datasheet. This was a cut a paste error related to a similar device, the ADS1115. If you were able to 'poll' the conversion ready flag then it would never work for DOUT/DRDY to respond as DRDY.
When you read the configuration back, the last bit must be forced high so that DOUT/DRDY will create a transition of states from high to low and signify completion of conversion. This can be used to trigger an interrupt. If you want to poll the device, just look at DOUT/DRDY without sending any clocks. If it is high, conversion is still in progress. If it is low, conversion is complete. This is actually much faster than reading the configuration. This is how the part was designed to work.
Best regards,
Bob B
I am not able to understand how 0C24 hex means 24.3 degree Celsius temperature of internal temperature sensor of ADS1118? Could you please explain?
Hi Ankit,
See code below that I use. It's CCS compiler code, but with the comments I think it's readable.
The function adc_TempReadTrig() return a -signed- integer of 0.1 degrees units. Thus 250 = 25.0 degress, -250 = -25.0 degrees.
You can use / adapt is as you like.
void adc_Init() { // init in single shot temperature conversion at 860 SPS // for now init is called after Flash initialisation. int8 tmp; CKE=0; // MCU spi shift out on pos edge output_low(En_Spi_ADS1118); tmp = spi_read(0x81); //start conversion, mux000, PGA000, single shot tmp = spi_read(0xF2); //rate 860SPS, TEMP, NoPull, valid data tmp = spi_read(0x0); tmp = spi_read(0x0); output_high(En_Spi_ADS1118); CKE=1; // MCU spi shift out on neg.edge, change back}void adc_TempReadTrig() { // function presumes that previous trigger was >= 1.5ms ago // the conversion ready bits of the ADS1118 do -not- function as status bits (-stupid!-) int8 tmp; int8 i80, i81; int16 i160; float f1; CKE=0; // MCU spi shift out on pos edge output_low(En_Spi_ADS1118); i80 = spi_read(0x81); i81 = spi_read(0xF2); tmp = spi_read(0); tmp = spi_read(0); output_high(En_Spi_ADS1118); CKE=1; i160 = make16(i80,i81); //make a temperature word i160>>=2; //undo the 'left justified' format if (bit_test(i160,13)) i160|=0xC000; //test sign-bit and if set(negative), and if also set b15&14 f1 = (float)((signed int16)i160) * 0.03125; //calculate degrees adc.iT = (signed int16)(f1*10); //convert to 0.1degree/lsb integer (250=25.0 degrees) and store it. }