Closed hellvesper closed 1 year ago
Hi.
Maybe, this issue it's not related with ads111x driver or esp8266 but with default example. I found same error working with esp32. Default example has a little "bug" in measure function.
static void measure(size_t n)
{
// wait for conversion end
bool busy;
do
{
ads111x_is_busy(&devices[n], &busy);
}
while (busy);
// Read result
int16_t raw = 0;
if (ads111x_get_value(&devices[n], &raw) == ESP_OK)
{
float voltage = gain_val / ADS111X_MAX_VALUE * raw;
printf("[%u] Raw ADC value: %d, voltage: %.04f volts\n", n, raw, voltage);
}
else
printf("[%u] Cannot read ADC value\n", n);
}
Problem raises in this lines:
bool busy;
do
{
ads111x_is_busy(&devices[n], &busy);
}
while (busy);
Every time you want to read an input ADC value, code waits for OS bit in CONFIG register to be setted however that never occurs.
If you see example code, the devices are configured to run in continuos mode. In this mode, OS bit is never used internally by device (it is not setted/cleared every conversion cycle) so example enters in a non finish loop. To solve it, remove or comment this do while
loop.
When working in continuos mode, the only way to know when a conversion is completed is to use RDY/ALERT pin.
The issue
ads111x driver and ESP8266 with rtos-sdk (master v.3.4) doesn't work in my case. I'm using an example code. My hardware is wemos d1 mini (esp8266) + ads1115 connected to GPIO 4 and 5. I know that wiring is correct and all modules is working properly because it works with another driver:
But with
ads111x
driver I got panic and bootloops, here the console output:When I set log level to DEBUG, I got this:
Looks like an isssue with I2C bus
Which SDK are you using?
ESP8266 RTOS SDK
Which version of SDK are you using?
master (3.4)
Which build target have you used?
Component causing the issue
ads111x
Anything in the logs that might be useful for us?
No response
Additional information or context
No response
Confirmation