Open dolence opened 10 months ago
Hi @dolence! We appreciate you submitting your first issue for our open-source project. 🌟
Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙
Giving the lack of documentation on this, I was told to mention and ask @str4t0m for help.
Hi! Any guidance on here?
Hi, I'm going over this and the on-going discussions on Discord. I'm capturing some thoughts here to hopefully provide some guidance on how to move forward:
I suggest decoupling the issue in separate areas and tackle them in isolation. In this case, I see two issues: a. How to add multiple devices to a W1 bus with DS2482-800. b. How to use the Sensor APIs to interact with multiple DS18B20s at once.
Thoughts on how to add multiple devices to a W1 bus with DS2482-800 DS2482-800 implements a W1 driver, and from a perspective of W1 device drivers (e.g: DS18B20), it should be transparent whether that signal comes from a MCU pin or from a bridge. As you've already mentioned, there's a different device-tree syntax to express devices that go on each of the W1 lines (e.g: one on IO1, one on IO2, and so forth) vs lump them in the same line (e.g: both on W1). By the looks of it, this should just work and no additional effort on your side.
Thoughts on how to use the Sensor APIs to interact with multiple DS18B20s at once:
a. Fitting in the "Device Model" to your use-case: The difference here is what we consider a "device" in terms of the sensor APIs. Currently, the DS18B20 driver models the "device" as a single-instance. Your use-case calls for changing that paradigm towards a "device" being an array of DS18B20, with each instance being a channel. Unfortunately, this is not developed so you'd have to come up with this solution or wait until someone else contributes it.
b. Suggestions on expanding the driver: Essentially, you'd implement a driver using the sensor read/decode APIs to take advantage of the sensor_chan_spec
(which includes the channel-type + index). Some specifics on how to achieve that:
I'm CC-ing @teburd in case I've missed anything.
LMK if you have any questions!
There is no sample on how to connect and read multiple ds18b20 connected trhough an ds2482-800. I have two ds2482-800 connected on my custom board. I'm able to scan sensors connected on channel 0 of the first IC using the sample provided, but there is no information on how to convert the temperature on multiple sensors connected using this IC.
Is everything done using ds2482 functions to read and set bytes of data or is there any easier way to do this using sensor api and ds18b20 functions?
On my use case I will need to scan every channel on both ds2482 and store them in order on my eeprom. One way I found was scanning an entire channel and order them cycling from the first to the last sensor, identifying them by forcing a temperature change on the sensor on that particular cable, doing this in sequence from the first to the last one.
Also, I'm not sure my overlay dts file is correct. I do need to declare every channel or just the first on each ds2482 would be OK?
This is what I have right now:
Any help would be very appreciated.