• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to disable and enable the 1Wire bus (M503)

    Official API - Evok
    4
    23
    9952
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Vesa Kauppinen
      Vesa Kauppinen @Martin Kudláček last edited by

      @martin-kudláček

      Thank you!

      Can you give a noob example of how to set 'MWD Enable' to 1 with pollmb.py?

      Br,
      Vesa

      Martin Kudláček 1 Reply Last reply Reply Quote 0
      • Martin Kudláček
        Martin Kudláček @Vesa Kauppinen last edited by

        @vesa-kauppinen

        Sorry, I've never used the pollmb.py. Would be the mbpoll example sufficient? You can install the mbpoll from our repository: apt update && apt install mbpoll

        Martin

        Vesa Kauppinen 1 Reply Last reply Reply Quote 0
        • Vesa Kauppinen
          Vesa Kauppinen @Martin Kudláček last edited by

          @martin-kudláček

          Yes. If you can give mbpoll example that would be great!

          :)

          Br,
          Vesa

          Martin Kudláček 1 Reply Last reply Reply Quote 0
          • Martin Kudláček
            Martin Kudláček @Vesa Kauppinen last edited by

            @vesa-kauppinen

            For Group 1 on M503

            Verify the status of the MWD (if 0 - MWD disable, if 1 - MWD enabled but never rebooted, if 2 - MWD enabled and already rebooted):
            mbpoll -m tcp -a 0 127.0.0.1 -0 -1 -r 6

            Set the MWD timeout to 5000ms:
            mbpoll -m tcp -a 0 127.0.0.1 -0 -r 1008 5000

            Enable the MWD:
            mbpoll -m tcp -a 0 127.0.0.1 -0 -r 6 1

            Write the settings to the NVRAM:
            mbpoll -m tcp -a 0 127.0.0.1 -0 -t 0 -r 1003 1

            Verify the MWD by stopping the UniPi Modbus TCP server:
            sudo systemctl stop unipitcp

            The both lines of LEDs should blink for 1sec after the MWD timeout

            Disable the MWD:
            mbpoll -m tcp -a 0 127.0.0.1 -0 -r 6 0

            Write the settings to the NVRAM:
            mbpoll -m tcp -a 0 127.0.0.1 -0 -t 0 -r 1003 1

            For Group 2 on M503
            Use the MWD control register 114 instead of 6
            Use the MWD timeout register 1108 instead of 1008
            Use the Save configuration coil 1103 instead of 1003

            Vesa Kauppinen 1 Reply Last reply Reply Quote 0
            • Vesa Kauppinen
              Vesa Kauppinen @Martin Kudláček last edited by

              @martin-kudláček

              Thanks for the good instructions! After enabling MWD, setting timeout and writing the settings:

              mbpoll -m tcp -a 0 127.0.0.1 -0 -1 -r 6
              mbpoll 1.2-6 - FieldTalk(tm) Modbus(R) Master Simulator
              Copyright (c) 2015 epsilonRT, All rights reserved.
              This software is governed by the CeCILL license <http://www.cecill.info>
              
              Protocol configuration: Modbus TCP
              Slave configuration...: address = [0]
                                      start reference = 6, count = 1
              Communication.........: 127.0.0.1, port 502, t/o 1.00 s, poll rate 1000 ms
              Data type.............: 16-bit register, output (holding) register table
              
              -- Polling slave 0...
              [6]:    3
              

              ...or...

              mbpoll -m tcp -a 0 127.0.0.1 -0 -1 -r 114
              mbpoll 1.2-6 - FieldTalk(tm) Modbus(R) Master Simulator
              Copyright (c) 2015 epsilonRT, All rights reserved.
              This software is governed by the CeCILL license <http://www.cecill.info>
              
              Protocol configuration: Modbus TCP
              Slave configuration...: address = [0]
                                      start reference = 114, count = 1
              Communication.........: 127.0.0.1, port 502, t/o 1.00 s, poll rate 1000 ms
              Data type.............: 16-bit register, output (holding) register table
              
              -- Polling slave 0...
              [114]:  3
              

              What does that result (3) mean? Its not 0, 1 or 2.

              Btw

              sudo systemctl stop unipitcp
              

              should be

              sudo systemctl stop neurontcp
              

              in Neuron M503...right??

              Br,
              Vesa

              Martin Kudláček 1 Reply Last reply Reply Quote 0
              • Martin Kudláček
                Martin Kudláček @Vesa Kauppinen last edited by Martin Kudláček

                Hi @vesa-kauppinen,
                sorry the value 3 is 1 + 2, which means board has MWD enabled and the MWD already rebooted the board.

                The service is called unipitcp, but in older packages it was called neurontcp. The service is the same for Neurons and Axons, so we renamed it to unipitcp to make it more clear.

                Best regards,
                Martin

                Vesa Kauppinen 1 Reply Last reply Reply Quote 0
                • Vesa Kauppinen
                  Vesa Kauppinen @Martin Kudláček last edited by Vesa Kauppinen

                  @martin-kudláček

                  Aaaaa...of course :D

                  But what about this: either 11 or 3

                  root@residevice:~# mbpoll -m tcp -a 0 127.0.0.1 -0 -1 -r 6
                  mbpoll 1.2-6 - FieldTalk(tm) Modbus(R) Master Simulator
                  Copyright (c) 2015 epsilonRT, All rights reserved.
                  This software is governed by the CeCILL license <http://www.cecill.info>
                  
                  Protocol configuration: Modbus TCP
                  Slave configuration...: address = [0]
                                          start reference = 6, count = 1
                  Communication.........: 127.0.0.1, port 502, t/o 1.00 s, poll rate 1000 ms
                  Data type.............: 16-bit register, output (holding) register table
                  
                  -- Polling slave 0...
                  [6]:    11
                  
                  root@residevice:~# mbpoll -m tcp -a 0 127.0.0.1 -0 -1 -r 6
                  mbpoll 1.2-6 - FieldTalk(tm) Modbus(R) Master Simulator
                  Copyright (c) 2015 epsilonRT, All rights reserved.
                  This software is governed by the CeCILL license <http://www.cecill.info>
                  
                  Protocol configuration: Modbus TCP
                  Slave configuration...: address = [0]
                                          start reference = 6, count = 1
                  Communication.........: 127.0.0.1, port 502, t/o 1.00 s, poll rate 1000 ms
                  Data type.............: 16-bit register, output (holding) register table
                  
                  -- Polling slave 0...
                  [6]:    3
                  
                  root@residevice:~# mbpoll -m tcp -a 0 127.0.0.1 -0 -1 -r 6
                  mbpoll 1.2-6 - FieldTalk(tm) Modbus(R) Master Simulator
                  Copyright (c) 2015 epsilonRT, All rights reserved.
                  This software is governed by the CeCILL license <http://www.cecill.info>
                  
                  Protocol configuration: Modbus TCP
                  Slave configuration...: address = [0]
                                          start reference = 6, count = 1
                  Communication.........: 127.0.0.1, port 502, t/o 1.00 s, poll rate 1000 ms
                  Data type.............: 16-bit register, output (holding) register table
                  
                  -- Polling slave 0...
                  [6]:    11
                  

                  Br,
                  Vesa

                  Martin Kudláček 1 Reply Last reply Reply Quote 0
                  • Martin Kudláček
                    Martin Kudláček @Vesa Kauppinen last edited by

                    @vesa-kauppinen

                    Ok, this is a little bit tricky. The register has 16bits, and some of the bits represent some state or function.

                    Bit 0: Set or read the status of the MWD
                    Bit 1: The MWD rebooted the boarde
                    other bits contain some debug information, which we haven't documented yet

                    So value 11 in decimal is 0000 0000 0000 1011 in binary. The bit no. 0 (first from the right) is 1, which means MWD is enabled. The bit no. 1 (second from the right) is 1, which means MWD already rebooted the board. Other bits don't apply to you.

                    You can "mask" the lowest 2 bits with boolean operation AND, typically with bit mask in hexadecimal representation:

                    register_6 && 0x0003

                    Or with binary mask:

                    register_6 && 0b11

                    I hope this helps you.
                    Martin

                    Vesa Kauppinen 2 Replies Last reply Reply Quote 0
                    • Vesa Kauppinen
                      Vesa Kauppinen @Martin Kudláček last edited by

                      @martin-kudláček

                      Okay. This clarified the case :)

                      Thank you!

                      Br,
                      Vesa

                      1 Reply Last reply Reply Quote 0
                      • Vesa Kauppinen
                        Vesa Kauppinen @Martin Kudláček last edited by Vesa Kauppinen

                        @martin-kudláček

                        Hi...again

                        One more stupid question: How do I reset 1-wire bus with mbpoll?

                        I mean, how can i "convert" those commands:

                        ./pollmb.py -p 502 -u 1 -f 5 -a 1001 -q 1 -d 1
                        ./pollmb.py -p 502 -u 1 -f 5 -a 1001 -q 1 -d 0
                        

                        to mbpoll "format". I just don't understand how to read/write coils with mbpoll.

                        Thank you!
                        Vesa

                        Martin Kudláček 1 Reply Last reply Reply Quote 0
                        • Martin Kudláček
                          Martin Kudláček @Vesa Kauppinen last edited by

                          Hi @vesa-kauppinen,
                          writing 1 to coil 1001:

                          mbpoll -m tcp -a 0 127.0.0.1 -t 0 -0 -r 1001 1

                          Writing 0:

                          mbpoll -m tcp -a 0 127.0.0.1 -t 0 -0 -r 1001 0

                          You can learn more from the quite detailed help of the mbpoll:

                          mbpoll -h

                          Regards,
                          Martin

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post