Hi there, while I appreciate your frustration, the library is a contributed community library.
Testing each contributed library is unfortunately not a feasible approach.
The compilation test is a compromise, and has a warning that states it does not guarantee the library will be functional.
Generally; the approach here would be to submit an issue via Github so that the author of the library can take a look: Issues Β· particle-iot/OneWireLibrary Β· GitHub
If you have a contribution/fix, Github is also the path to get it in.
It is not currently possible to use the OneWire (DS18B20) protocol on the RTL872x (P2, Photon 2, M-SoM). The speed of the GPIO is not sufficient to support the protocol in bit-bang mode as the OneWire library does.
In theory, it may be possible to use the SPI peripheral, which is how the NeoPixel library was implemented on RTL872x, however there is no implementation at this time. Also, since SPI has separate read and write pins, and OneWire is a single pin, it would also require some additional hardware to manage dupexing.
The only viable alternative is to use an I2C to OneWire bridge at this time.
@no1089 It looks like someone updated the OneWireLibrary README.md - thanks!
@rickkas7 Yeah, I have some DS2482's on the way now. I spent yesterday banging my head on a wall, since all the signals looked clean, and worked on other micros so I was neck deep in several libraries trying to figure it out. Have you seen any adapter boards with a DS2482, 5V 1-Wire to 3.3V logic and TVS protection?
I have not seen a pre-built adapter board for the DS2482. I've added them to my boards for a long time, even on gen 3 (nRF52) devices because it's so much more efficient with the bridge chip. The DS2482-RK library works well on both nRF52 and RTL872x devices and is fully asynchronous and works well with multi-drop if you need that.
The Tracker OneWire project is for the Tracker, but if you leave off the M8 connection and voltage regulator it would work on any device.
It has a PCA9306 for I2C level shifting to 5V and runs the DS2482-100 at 5V. It's really simple and the SOIC versions of those chips are easy to solder.
Thanks for that- that's a good board reference. I had been looking at the DS2483 / DS2484 as well which have independent I2C and 1-Wire voltages and built-in ESD protection which reduces the part count considerably.
As far as I can tell the only difference between the DS2483 and DS2484 is that the DS2484 adds 1.8V 1-Wire support to the 3.3V and 5.0V.
They both can do I2C at 1.8V, 3.3V and 5.0V based on a separate supply pin.
In my case I think I would just use Vusb for the 5 volt 1-Wire supply.
I haven't looked to see if they'll be library compatible or easily portable but otherwise they simplify things considerably and actually cost less. Don't know if you can comment here on compatibility...?
Oh wow, that's a way better chip. There are a few new configuration parameters but the bulk of the I2C registers appear to be the same. There's an app note for migrating and it looks easy.
Based on the datasheets it looks like DS2484 corrected the minimum 1-Wire Vcc that may have been errantly high in the DS2483 silicon. They took care of some other DS2483 quirks since they were having to do a revision.
I1C Address pins A0 & A1 are just moved into register along with the other address bits (Figure 8 in all 3 datasheets)
The communications examples are all identical except the new chips add sections:
Adjust 1-Wire Port (after power-up, e.g., to select a 1-Wire timing other than the default)
I tested the DS18B20 via DS2484 with the Adafruit Library on the P2 and it works. Note that @rickkas7 also posted an Asynchronous library example above, but it you want to use the Adafruit Lib here's some example code:
Note: You need to copy Adafruit_BusIO and Adafruit_DS248x into your_project_folder/lib then create a src folder in each library and move the .ccp and .h files into their respective src folders.