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

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

    Scheduled Pinned Locked Moved Official API - Evok
    23 Posts 4 Posters 15.2k Views 1 Watching
    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 KauppinenV
      Vesa Kauppinen @Martin Kudláček
      last edited by Vesa Kauppinen

      @martin-kudláček

      Hi,

      That's what we've done with 1-Wire and it works.

      I mean, is it possible to do this same 'reset' for Modbus (RTU) itself? We sometimes lose a modbus device.

      Br,
      Vesa

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

        Oh, sorry for the misunderstanding @vesa-kauppinen.

        We have a functionality called Master Watch Dog (MWD). When enabled, the underlying HW will watch when the last communication happend. If it will be longer than the preset time, it will reboot itself. Now, this can be set per group in the PLC, and it will watch if the ModbusTCP server communicates with the given group. If not, the board will reboot. Similarly, this can be set on the extensions as well. If nothing communicates with the extension over ModbusRTU, the extension reboots itself.

        This can be set via modbus. Look for the "Enable MWD" coil and "MWD timeout" register. The timeout is in miliseconds.

        Best regards,
        Martin

        Vesa KauppinenV 1 Reply Last reply
        Reply Quote 0
        • Vesa KauppinenV
          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áčekM 1 Reply Last reply
          Reply Quote 0
          • Martin KudláčekM
            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 KauppinenV 1 Reply Last reply
            Reply Quote 0
            • Vesa KauppinenV
              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áčekM 1 Reply Last reply
              Reply Quote 0
              • Martin KudláčekM
                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 KauppinenV 1 Reply Last reply
                Reply Quote 0
                • Vesa KauppinenV
                  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áčekM 1 Reply Last reply
                  Reply Quote 0
                  • Martin KudláčekM
                    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 KauppinenV 1 Reply Last reply
                    Reply Quote 0
                    • Vesa KauppinenV
                      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áčekM 1 Reply Last reply
                      Reply Quote 0
                      • Martin KudláčekM
                        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 KauppinenV 2 Replies Last reply
                        Reply Quote 0
                        • Vesa KauppinenV
                          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 KauppinenV
                            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áčekM 1 Reply Last reply
                            Reply Quote 0
                            • Martin KudláčekM
                              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

                              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                              With your input, this post could be even better 💗

                              Register Login
                              • First post
                                Last post