zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.04k stars 6.18k forks source link

ds18b20: Very slow to query multiple sensors, RTIO needed? #65706

Open towen opened 7 months ago

towen commented 7 months ago

Is your enhancement proposal related to a problem? Please describe. Querying one ds18b20 sensor takes more than 750ms due to the delay required by the sensor for the internal ADC conversion to complete. This is unavoidable without reducing the resolution.

However, when querying multiple sensors, this delay time is multiplied by the number of sensors unnecessarily, because ds18b20_sample_fetch() simply calls k_msleep.

In my application, I have 5 sensors on the bus, and it takes 3.8 seconds to query them all.

Describe the solution you'd like The driver could perhaps implement RTIO so that ADC conversions could be started asynchronously, but I'm not confident enough to do this myself.

Describe alternatives you've considered

@str4t0m hello, I believe we met at ZDS2023 :)

dolence commented 1 month ago

Would be nice if one could use the multidrop capability to send the convert command to all the sensors on a given bus skipping their roms and then read one by one usng their ROM IDs. This is what I've been struggling to achieve using a DS2482-800 and multiple (unknown number at compiling time) sensors on each bus. Any thoughts on this?