How to disable and enable the 1Wire bus (M503)
-
Hello @vesa-kauppinen,
yes, check our Modbus Registers Maps: https://kb.unipi.technology/files:products:02-neuronFor M503 it is coil 1001 - Enable/Disable 1Wire Bus
Best regards,
Martin -
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 -
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 -
-
-
-
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 -
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 -
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 -
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 -
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 yetSo 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 -
-
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 -
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