-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Library crashes when using other I2C devices #2
Comments
Hello! What library are you using for the ADS1115? My first thought is that the other library could be clobbering something set up by the INA220 library. Do you have an oscilloscope or logic analyzer? It could be useful to capture the INA220 I2C signals with and without the ADS1115 library active, to see what changes between the two configurations (speed, voltage, data, etc). What incorrect value do you see returned by the INA, and which register is it? Is the value the same no matter which register you read? If you are able to upload your code, I'd also like to take a look at that. |
I fixed it!?!? I have the last days been making my own version of your library. This has been good as now I really understand how the INA device works. But when making an example to you, suddenly I get both INA and ADS to work on the same I2C line with your library. Very strange. I assume that there is something wrong with my original code. I will leave it and write a new one where I have all the functions working. But thanks again for a great library! Also the source files are very understandable and usable. Professional work! Below is your example code with the ADS added. This code is working and giving results from both INA and ADS. `#include <INA220.h> /******************
INA220 ina220; void setup() { pinMode(14, OUTPUT); uint8_t availableDevices = ina220.begin(MAX_CUR, SHUNT_R, INA_ADC_MODE_128AVG, INA_ADC_MODE_128AVG, INA_MODE_CONTINUOUS_BOTH, ina_addresses, NUM_INA); void loop() {
} |
That's great! I'm glad to hear you got it working with the example code. Writing your own library (or modifying someone else's) is definitely a great way to learn the chip. Please let me know if you have any more issues with the library. |
This INA220 library is awesome and it is working perfectly. Or perfectly until I add another I2C device to the bus. The other device works but INA220 dies.
For example I have the INA220 (addres 0x40) and an ADS1115 AD board (address 0x48) connected to the same I2C line on my ESP32. When INA220 is alone it works perfectly with this library. But when both devices are initialized, INA220 dies. It gives the same strange values with each read request.
But if I skip INA library and read manually the INA registers with the Wire library, I get the correct reading while also ADS1115 is initialized.
I can have both devices physically connected to the I2C line at the same time. Problems start when I initialize the libraries for the devices (ads.begin(); and ina220.begin(...);). If I only initialize INA library (ina220.begin(...)) the device works properly.
What could cause this?
The text was updated successfully, but these errors were encountered: