Доступ к порту RS-485 контроллера Wiren Board с компьютера/en: различия между версиями

Материал из Wiren Board
(Новая страница: «Access to the RS-485 port of the Wiren Board controller from a computer»)
 
(Новая страница: «The -d and -x options can be omitted in both cases - they are needed for diagnostic output and hexadecimal data dumps.»)
 
(не показано 10 промежуточных версий этого же участника)
Строка 1: Строка 1:
<languages/>
<languages/>
'''Внимание!''' Данные инструкции следует выполнять только
'''Attention!''' These instructions should only be performed on a private subnet. Do not allow RS-485 ports to be accessed over TCP if the Wiren Board is accessible over a real IP from the outside.
в закрытой подсети. Не следует давать доступ к RS-485 портам
по TCP, если Wiren Board доступен по реальному IP снаружи.


Допустим, Wiren Board имеет IP 192.168.3.12.
Let's say the Wiren Board has 192.168.3.12 IP address.


Выполняем на Wiren Board от root:
Run this commands on Wiren Board from root access:
<pre>
<pre>
apt-get install socat
apt-get install socat
service wb-mqtt-serial stop     
service wb-mqtt-serial stop     
</pre>
</pre>
В старых версиях контроллеров используйте команду serive wb-homa-modbus stop.
In older versions of controllers, use the '''serive wb-homa-modbus stop''' command.
<pre>
<pre>
socat -d -d -d -x /dev/ttyRS485-1,raw,ispeed=9600,ospeed=9600,parenb=0,cstopb=1,cs8 TCP-LISTEN:10010&
socat -d -d -d -x /dev/ttyRS485-1,raw,ispeed=9600,ospeed=9600,parenb=0,cstopb=1,cs8 TCP-LISTEN:10010&
Строка 17: Строка 15:
</pre>
</pre>


В старых версиях контроллеров указывайте порты [/dev/ttyNSC0, /dev/ttyNSC1] или [/dev/ttyAPP1, /dev/ttyAPP4].
In older versions of controllers, specify ports [/dev/ttyNSC0, /dev/ttyNSC1] or [/dev/ttyAPP1, /dev/ttyAPP4].




Обратите внимание на кодирование количества стоп-битов:  
Note the coding of the number of stop bits:
* cstopb=1 — 2 стоп-бита,
* cstopb=0 — 1 стоп-бит.
Параметр cstopb имеет булевский тип; подробнее смотрите в интернете '''man socat'''.


*cstopb=1 — 2 stop bits,
*cstopb=0 — 1 stop bit.
Option cstopb has the Boolean type; refer to the '''man socat''' articles online.


Вторая команда (service wb-mqtt-serial stop) — остановка драйвера Modbus во избежание конфликтов при работе с RS-485 портами.


Выполняем на компьютере (под Linux):
The second command (service wb-mqtt-serial stop) is to stop the Modbus driver to avoid conflicts when working with RS-485 ports.
 
Run on a computer (Linux based):
<pre>
<pre>
socat -d -d -d -x PTY,raw,ispeed=9600,ospeed=9600,parenb=0,cstopb=1,cs8,link=/dev/ttyRS485-1 tcp:192.168.3.12:10010&
socat -d -d -d -x PTY,raw,ispeed=9600,ospeed=9600,parenb=0,cstopb=1,cs8,link=/dev/ttyRS485-1 tcp:192.168.3.12:10010&
Строка 35: Строка 34:
</pre>
</pre>


В старых версиях контроллеров указывайте порты [/dev/ttyNSC0, /dev/ttyNSC1] или [/dev/ttyAPP1, /dev/ttyAPP4].
In older versions of controllers, specify ports [/dev/ttyNSC0, /dev/ttyNSC1] or [/dev/ttyAPP1, /dev/ttyAPP4].


После выполнения этих команд в системе (на PC) появляются
After executing these commands, special files /dev/ttyRS485-1 and /dev/ttyRS485-2 appear in the system (on the PC), corresponding to RS-485 ports of the Wiren Board. The latter command creates symbolic links to port files in /dev for convenience, which allows, for example, to use the Modbus driver configuration written for the Wiren Board on a PC without any changes.  
специальные файлы /dev/ttyRS485-1 и /dev/ttyRS485-2, соответствующие
RS-485 портам Wiren Board. Последняя команда для удобства создаёт
в /dev символические ссылки на файлы портов, что позволяет,
например, использовать на PC конфигурацию драйвера Modbus,
написанную для Wiren Board, без каких-либо изменений.  


Опции -d и -x в обоих случаях можно опустить - они нужны для
The -d and -x options can be omitted in both cases - they are needed for diagnostic output and hexadecimal data dumps.
вывода диагностики и шестнадцатеричных дампов передаваемых данных.

Текущая версия на 20:38, 30 мая 2019

Другие языки:

Attention! These instructions should only be performed on a private subnet. Do not allow RS-485 ports to be accessed over TCP if the Wiren Board is accessible over a real IP from the outside.

Let's say the Wiren Board has 192.168.3.12 IP address.

Run this commands on Wiren Board from root access:

apt-get install socat
service wb-mqtt-serial stop    

In older versions of controllers, use the serive wb-homa-modbus stop command.

socat -d -d -d -x /dev/ttyRS485-1,raw,ispeed=9600,ospeed=9600,parenb=0,cstopb=1,cs8 TCP-LISTEN:10010&
socat -d -d -d -x /dev/ttyRS485-2,raw,ispeed=9600,ospeed=9600,parenb=0,cstopb=1,cs8 TCP-LISTEN:10011&

In older versions of controllers, specify ports [/dev/ttyNSC0, /dev/ttyNSC1] or [/dev/ttyAPP1, /dev/ttyAPP4].


Note the coding of the number of stop bits:

  • cstopb=1 — 2 stop bits,
  • cstopb=0 — 1 stop bit.

Option cstopb has the Boolean type; refer to the man socat articles online.


The second command (service wb-mqtt-serial stop) is to stop the Modbus driver to avoid conflicts when working with RS-485 ports.

Run on a computer (Linux based):

socat -d -d -d -x PTY,raw,ispeed=9600,ospeed=9600,parenb=0,cstopb=1,cs8,link=/dev/ttyRS485-1 tcp:192.168.3.12:10010&
socat -d -d -d -x PTY,raw,ispeed=9600,ospeed=9600,parenb=0,cstopb=1,cs8,link=/dev/ttyRS485-2 tcp:192.168.3.12:10011&
sudo ln -fs /tmp/ttyRS485-{1,2} /dev

In older versions of controllers, specify ports [/dev/ttyNSC0, /dev/ttyNSC1] or [/dev/ttyAPP1, /dev/ttyAPP4].

After executing these commands, special files /dev/ttyRS485-1 and /dev/ttyRS485-2 appear in the system (on the PC), corresponding to RS-485 ports of the Wiren Board. The latter command creates symbolic links to port files in /dev for convenience, which allows, for example, to use the Modbus driver configuration written for the Wiren Board on a PC without any changes.

The -d and -x options can be omitted in both cases - they are needed for diagnostic output and hexadecimal data dumps.