UncleRus / esp-idf-lib

Component library for ESP32-xx and ESP8266
https://esp-idf-lib.readthedocs.io/en/latest/
1.33k stars 414 forks source link

ADS111x driver bug (and fix) dealig with ALERT/RDY signal #641

Closed rafa400 closed 2 weeks ago

rafa400 commented 2 weeks ago

The issue

Problem: The ALERT/RDY pin triggers without apparent cause. Tested with ADS1015 (ADS111x has same config register fields with ADS1114 and ADS1115). The problem is located into the two bits offset definition to control the behaviour of that signal, due to de lack of any set value for the bit 0 (the wrong definition starts with the bit 1). The AD is also supposed to have a default value (disabled) on power on, but in some not controlled situations, it changes and gets enabled. Also, the actual wrong definition avoids any attempt to correct the situation.

At: https://github.com/UncleRus/esp-idf-lib/blob/e2052b386a04d725cc6fdce7edd2fc92117b5b5f/components/ads111x/ads111x.c#L53

According with both datasheets (ADS101x and ADS111x, ~pdf page 25 or search COMP_QUE ) should be:

#define COMP_QUE_OFFSET 0

That fixes the issue for me and is tested into my code for ADS1015 board.

Which SDK are you using?

esp-idf

Which version of SDK are you using?

ESP-IDF 4.4.4

Which build target have you used?

Component causing the issue

ADS111x ( ADS1015 )

Anything in the logs that might be useful for us?

No response

Additional information or context

https://www.ti.com/document-viewer/ADS1115/datasheet#config-register-p-1-0-1h-reset-8583h-sbas4442806/SBAS4442806 please take a look into COMP_QUE offset

Confirmation

UncleRus commented 2 weeks ago

Thank you!