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.
Hi
I'm developing my own device which uses ADS1115. I'm using connection as in the picture below. I configure ADS1115 as follows:
adcInitConf.compQue = COMP_QUE_ONE;
adcInitConf.compLat = COMP_LAT_ENABLE;
adcInitConf.compPol = COMP_POL_HIGH;
adcInitConf.compMode = COMP_MODE_WITH_HYSTERESIS;
adcInitConf.dr = DR_128_SPS;
adcInitConf.mode = MODE_SINGLE_SHOT;
adcInitConf.pga = PGA_6_1;
adcInitConf.mux = MUX_0_G;
adcInitConf.osWrite = OS_WRITE_BEGIN;
I'm waiting for 'alert/rdy' pin is high and read value from ADC. It works is well but if ADS1115 input is not connected or connected to ground ADC don't set 'alert/rdy' pin. In this case, I expect to get a zero value.
Any ideas? Is any additional information required?
Thanks very much,
For example.
I do initialization ADS1115:
BOOL ADS1115_Init(struct __I2C_HandleTypeDef *pIntfc) { struct ADS1115_Config adcInitConf; adcInitConf.compQue = ADS1115_COMP_QUE_ONE; adcInitConf.compLat = ADS1115_COMP_LAT_ENABLE; adcInitConf.compPol = ADS1115_COMP_POL_LOW; adcInitConf.compMode = ADS1115_COMP_MODE_WITH_HYSTERESIS; adcInitConf.dr = ADS1115_DR_128_SPS; adcInitConf.mode = ADS1115_MODE_SINGLE_SHOT; adcInitConf.pga = ADS1115_PGA_4_1; adcInitConf.mux = ADS1115_MUX_0_G; adcInitConf.osWrite = ADS1115_OS_WRITE_BEGIN; uint8_t adcRegData[3]; ADS1115_MakeConfigData(&adcInitConf, adcRegData); // Writing configuration data to ADS1115 if(HAL_I2C_Master_Transmit(pIntfc, ADS1115_ADR << 1, adcRegData, 3, ADS1115_TIMEOUT_TRANSMIT) != HAL_OK) { return FALSE; } // Writing 0x0000 to Lo register ADS1115 adcRegData[0] = ADS1115_REG_ADDR_LO_THR; // 2 adcRegData[1] = (uint8_t)(0x00); adcRegData[2] = (uint8_t)(0x00); if(HAL_I2C_Master_Transmit(pIntfc, ADS1115_ADR << 1, adcRegData, 3, ADS1115_TIMEOUT_TRANSMIT) != HAL_OK) { return FALSE; } // Writing 0xFFFF to Hi register ADS1115 adcRegData[0] = ADS1115_REG_ADDR_HI_THR; // 3 adcRegData[1] = (uint8_t)(0xFF); adcRegData[2] = (uint8_t)(0xFF); if(HAL_I2C_Master_Transmit(pIntfc, ADS1115_ADR << 1, adcRegData, 3, ADS1115_TIMEOUT_TRANSMIT) != HAL_OK) { return FALSE; } return TRUE; }
And then I read value use for example same function:
BOOL ADS1115_ReadInput(struct __I2C_HandleTypeDef *pIntfc, const uint8_t *pConfigRegister, uint16_t *inputValue) { // Say to make a measurement if(HAL_I2C_Master_Transmit(pIntfc, ADS1115_ADR << 1, pConfigRegister, 3, ADS1115_TIMEOUT_TRANSMIT) != HAL_OK) { return FALSE; } uint32_t tickstart = HAL_GetTick(); // Wait until ADC has done measure while(HAL_GPIO_ReadPin(ADC_Alert_GPIO_Port, ADC_Alert_Pin) != GPIO_PIN_RESET) { if ((HAL_GetTick() - tickstart) > ADS1115_TIMEOUT_TRANSMIT) { return FALSE; } } // Reading data from ADC uint8_t reciveData[2]; uint8_t addrConvReg = ADS1115_REG_ADDR_CONV; if(HAL_I2C_Master_Transmit(pIntfc, ADS1115_ADR << 1, &addrConvReg, 1, ADS1115_TIMEOUT_TRANSMIT) != HAL_OK) { return FALSE; } if(HAL_I2C_Master_Receive(pIntfc, ADS1115_ADR << 1, reciveData, 2, ADS1115_TIMEOUT_TRANSMIT) != HAL_OK) { return FALSE; } // Put data to inputValue *inputValue = (reciveData[0] << 8); *inputValue |= (reciveData[1]); return TRUE; }
Joseph Wu,
I set the Hi_thresh register to 8000h and set the Lo_thresh register to 7FFF and it doesn't works.
On the first screen: I read the values of the registers from the ADS1115.
On the second screen: I showed that the ALERT/RDY Pin is always low. I think it should be like this: at the first point: set = 500000; reset = 0; at the second point: set = 3100(8ms), reset = 496900; at the third point: set = 500000; reset = 0;
Thanks
Joseph Wu,
In my last post I read registers Config, Lo_thresh and Hi_thresh. As you can see I use the parameters as you advised.
The Hi_thresh(Data[2]) = 0x8000;
The Lo_thresh(Data[1])=0x7fff;
The Config(Data[0])=0x4384;
In this case in the Config register(0x4384) I have:
Parameter |
Current value (Binary) |
Meaning |
COMP_QUE |
00 |
Assert after one conversion |
COMP_LAT |
1 |
Non-latching comparator |
COMP_POL |
0 |
Active low |
COMP_MODE |
0 |
Traditional comparator with hysteresis |
DR |
100 |
128SPS |
MODE |
1 |
Power-down single-shot mode |
PGA |
001 |
FS = ±4.096V |
MUX |
100 |
AIN P = AIN0 and AIN N = GND |
OS |
0 |
Device is currently performing a conversion |
Thanks
Artem
Joseph Wu,
Now, I have such a situation: state the ALERT/RDY Pin always is LOW, when I send the command to 'start measure' the ALERT/RDY Pin change state to HIGH on 8 ms and then it change to LOW even after reading measured value. I think after reading measured value ALERT/RDY Pin has to change state (to reset) to HIGH. Why isn't it working?