• 1-wire behaviour on Bookworm

    From druck@news@druck.org.uk to comp.sys.raspberry-pi on Thu Sep 19 10:36:16 2024
    From Newsgroup: comp.sys.raspberry-pi

    After getting another Pi 5, I've moved a Pi 4B running Bookworm in to
    the role taken by a Pi 3B running Bullseye, which is monitoring 6
    ds18b20 sensors, configured as 2 1-wire buses with 3 sensors on each.

    With the Pi 3B, I could either read the sensors sequentially taking
    about 0.9s each, or using threads simultaneously in 1.0s. The Pi 4B with Bookworm reads the sensors sequentially a shade faster at just over
    0.8s, but when reading simultaneously, returns 2 after 0.8s, another 2
    after 1.6s and the last two at 2.4s.

    Anyone have an explanation for this?

    It's not a problem as I changed some time ago from performing one
    simultaneous read every 5 minutes to reading sequentially every minute
    and averaging over 15 minutes.

    ---druck
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.sys.raspberry-pi on Thu Sep 19 23:50:33 2024
    From Newsgroup: comp.sys.raspberry-pi

    On Thu, 19 Sep 2024 10:36:16 +0100, druck wrote:

    With the Pi 3B, I could either read the sensors sequentially taking
    about 0.9s each, or using threads simultaneously in 1.0s. The Pi 4B with Bookworm reads the sensors sequentially a shade faster at just over
    0.8s, but when reading simultaneously, returns 2 after 0.8s, another 2
    after 1.6s and the last two at 2.4s.

    Is this Python code? Python threading cannot currently take full advantage
    of multiple CPUs, owing to having to serialize all interpreter operations through the “Global Interpreter Lock”.

    This is going to be fixed from 3.13 onwards.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Aldridge@jpsa@cantab.net to comp.sys.raspberry-pi on Fri Sep 20 11:17:20 2024
    From Newsgroup: comp.sys.raspberry-pi

    In article <vcgrag$gsv0$2@dont-email.me>, news@druck.org.uk says...

    After getting another Pi 5, I've moved a Pi 4B running Bookworm in to
    the role taken by a Pi 3B running Bullseye, which is monitoring 6
    ds18b20 sensors, configured as 2 1-wire buses with 3 sensors on each.

    With the Pi 3B, I could either read the sensors sequentially taking
    about 0.9s each, or using threads simultaneously in 1.0s. The Pi 4B with Bookworm reads the sensors sequentially a shade faster at just over
    0.8s, but when reading simultaneously, returns 2 after 0.8s, another 2
    after 1.6s and the last two at 2.4s.

    Anyone have an explanation for this?

    No, but AIUI the "right" way to do this is to send the text "trigger" to /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read before reading the
    values as normal. The trigger causes them all to start a conversion at
    once, following which the reads all complete immediately once a single conversion time has elapsed.

    As a quick hack, try executing the following before reading your
    sensors...

    sudo su <<EOF
    echo trigger > /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read
    EOF
    --
    John
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From druck@news@druck.org.uk to comp.sys.raspberry-pi on Fri Sep 20 21:18:14 2024
    From Newsgroup: comp.sys.raspberry-pi

    On 20/09/2024 00:50, Lawrence D'Oliveiro wrote:
    On Thu, 19 Sep 2024 10:36:16 +0100, druck wrote:

    With the Pi 3B, I could either read the sensors sequentially taking
    about 0.9s each, or using threads simultaneously in 1.0s. The Pi 4B with
    Bookworm reads the sensors sequentially a shade faster at just over
    0.8s, but when reading simultaneously, returns 2 after 0.8s, another 2
    after 1.6s and the last two at 2.4s.

    Is this Python code? Python threading cannot currently take full advantage
    of multiple CPUs, owing to having to serialize all interpreter operations through the “Global Interpreter Lock”.

    It's a C program using posix threads.

    I did initially write a Python version using the ThreadPool from multiprocessing.dummy It is only milliseconds slower than the C as the
    Python threads are able to yield when goes out to the system to read the
    files in /sys/bus/w1/devices/

    This is going to be fixed from 3.13 onwards.

    That will be very useful for pure Python code. They are making things a
    bit challenging by deprecating some other things before getting there,
    which I'll need to sort out before moving on from 3.11.

    ---druck
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From druck@news@druck.org.uk to comp.sys.raspberry-pi on Fri Sep 20 21:38:09 2024
    From Newsgroup: comp.sys.raspberry-pi

    On 20/09/2024 11:17, John Aldridge wrote:
    [Reading ds18b20 sensors in parallel]
    No, but AIUI the "right" way to do this is to send the text "trigger" to /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read before reading the
    values as normal. The trigger causes them all to start a conversion at
    once, following which the reads all complete immediately once a single conversion time has elapsed.

    As a quick hack, try executing the following before reading your
    sensors...

    sudo su <<EOF
    echo trigger > /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read
    EOF

    Thanks, that seems to works for the first bus, but I get a permission
    denied when using w1_bus_master2.

    ---druck

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Aldridge@jpsa@cantab.net to comp.sys.raspberry-pi on Sun Sep 22 11:53:07 2024
    From Newsgroup: comp.sys.raspberry-pi

    In article <vckmfh$17vkc$2@dont-email.me>, news@druck.org.uk says...

    On 20/09/2024 11:17, John Aldridge wrote:
    [Reading ds18b20 sensors in parallel]
    No, but AIUI the "right" way to do this is to send the text "trigger" to /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read before reading the values as normal. The trigger causes them all to start a conversion at once, following which the reads all complete immediately once a single conversion time has elapsed.

    As a quick hack, try executing the following before reading your
    sensors...

    sudo su <<EOF
    echo trigger > /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read
    EOF

    Thanks, that seems to works for the first bus, but I get a permission
    denied when using w1_bus_master2.

    Sorry, I've no idea why that might be :(

    Though I do recall the permission checking being a bit odd -- hence the
    "sudo su" rather than a plain "sudo".
    --
    John
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Chris Elvidge@chris@internal.net to comp.sys.raspberry-pi on Sun Sep 22 12:45:45 2024
    From Newsgroup: comp.sys.raspberry-pi

    On 22/09/2024 at 11:53, John Aldridge wrote:
    In article <vckmfh$17vkc$2@dont-email.me>, news@druck.org.uk says...

    On 20/09/2024 11:17, John Aldridge wrote:
    [Reading ds18b20 sensors in parallel]
    No, but AIUI the "right" way to do this is to send the text "trigger" to >>> /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read before reading the
    values as normal. The trigger causes them all to start a conversion at
    once, following which the reads all complete immediately once a single
    conversion time has elapsed.

    As a quick hack, try executing the following before reading your
    sensors...

    sudo su <<EOF
    echo trigger > /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read
    EOF

    Thanks, that seems to works for the first bus, but I get a permission
    denied when using w1_bus_master2.

    Sorry, I've no idea why that might be :(

    Though I do recall the permission checking being a bit odd -- hence the
    "sudo su" rather than a plain "sudo".


    Have you tried
    'echo trigger | sudo tee /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read'
    --
    Chris Elvidge, England
    HIGH EXPLOSIVES AND SCHOOL DON'T MIX

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.sys.raspberry-pi on Sun Sep 22 23:34:21 2024
    From Newsgroup: comp.sys.raspberry-pi

    On Sun, 22 Sep 2024 11:53:07 +0100, John Aldridge wrote:

    Though I do recall the permission checking being a bit odd -- hence the
    "sudo su" rather than a plain "sudo".

    Either you’re root or you’re not. There’s no need to say “I am root” twice.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Chris Townley@news@cct-net.co.uk to comp.sys.raspberry-pi on Mon Sep 23 00:47:15 2024
    From Newsgroup: comp.sys.raspberry-pi

    On 23/09/2024 00:34, Lawrence the troll wrote:
    On Sun, 22 Sep 2024 11:53:07 +0100, John Aldridge wrote:

    Though I do recall the permission checking being a bit odd -- hence the
    "sudo su" rather than a plain "sudo".

    Either you’re root or you’re not. There’s no need to say “I am root”
    twice.

    Have you ever tried to manage a Linux system?

    There are distinct differences here

    Bloody trolls!
    --
    Chris

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From druck@news@druck.org.uk to comp.sys.raspberry-pi on Mon Sep 23 12:17:01 2024
    From Newsgroup: comp.sys.raspberry-pi

    On 22/09/2024 12:45, Chris Elvidge wrote:
    On 22/09/2024 at 11:53, John Aldridge wrote:
    In article <vckmfh$17vkc$2@dont-email.me>, news@druck.org.uk says...

    On 20/09/2024 11:17, John Aldridge wrote:
    [Reading ds18b20 sensors in parallel]
    sudo su <<EOF
    echo trigger > /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read
    EOF


    Have you tried
    'echo trigger | sudo tee /sys/bus/w1/devices/w1_bus_master1/therm_bulk_read'


    Yes, that works for bus 1, but not bus 2 on that Pi 4.

    On a Pi Zero 2W with 2 w1 buses, bus 1 gives the Permission denied error
    and bus 2 succeeds.

    On a Pi 3B+ with 4 w1 buses, 1 and 2 succeed, 3 and 4 fail.

    Very strange.

    ---druck






    --- Synchronet 3.20a-Linux NewsLink 1.114