bperrybap:
Ok,
Here is my experience playing with i2c on Arduino using the Wire library over the past 4 years and with using the DS3231 for around 3 years in clock project. (A word clock).You haven't said which "Arduino" you are using. Each core provides its own Wire library.
I have run into Wire library issues in the AVR, pic32 and esp8266 cores, and the SoftWire avr "soft" Wire library....
Well first of all, thanks for the detailed write up. My apologies, the arduino I'm using are all NANOs, atmega328, 16mhz.
The most important things I'm gleaning from all this is that (1) as an I2C master, I'm unlikely to run into lockup issues, (2) the lockup problems are usually caused by misbehaving slaves, and the better choice in these cases (as pointed out by another poster) is to refrain from using such devices, in favor of better ones.
I've also run many tests at this point, banging much more heavily on both my LCD and my RTS, and not once have I even seen a missed read or write, and certainly no lockups. The only exception has been an occasional lockup when I reset the board or upload new code, which causes two resets (never figured out why 2, and don't need to re-open that discussion). I suppose there are times when the reset occurs right in the middle of an I2C exchange. I don't expect any improved wire library to be able to fix that, and I can probably live with that if its the only problem case.
At this point, the only compelling reason I may have for making the newer I2C library totally replace WIRE, is to have the benefit of its alleged more compact code and faster execution. I'll have to do some experimenting with it to see if its worthwhile. But for now I think the existing WIRE library is good enough for at least "version 1" of my current project.
bperrybap:
For i2c backpack LCD support, I use my hd44780 library which auto locations the i2c address and auto configures the pin mappings and active backlight level.--- bill
I probably don't have the best HD44780 library. Something written by "Francisco Malpartida". But I'm using it because of all the HD44780 libraries out there, this was the first one where I could get the LCD to do anything with any of their examples. Not saying this would be the case with your library, but it seems people get so deep into making their libraries versatile, they forget to write a complete "getting started" guide to steer a new user through real world setups. Then they further complicate things by putting their ZIP file inside a TAR file, which itself is inside a ZIP. Don't get me started. But I digress.
I'd like to see your HD44780 library, though you didn't mention whether it uses the original WIRE lib or not (maybe I missed it)? But bottom line, any device library is used as a shortcut to a bigger task, which is your project that uses the device. The down side is that if a user thinks theyneed to do things differently, they can easily lose a ton of time trying to understand how the library works, and few people document their libraries with enough comments to do such modifications efficiently.