简体   繁体   English

Modbus RTU从站RS-485无法响应

[英]Modbus RTU slave RS-485 failed to response

I'm trying to write modbus slave and have one problem: I'm correctly receive requests from master, but when I try to response it's look like something is incorrectly sended to serialport, because when I plug RS485 sniffer - I see both req and res (in HEX). 我正在尝试编写Modbus从站,但有一个问题:我正确地接收了来自主站的请求,但是当我尝试响应时,似乎有些东西被错误地发送到了串行端口,因为当我插入RS485嗅探器时-我看到了req和分辨率(以十六进制表示)。

Hardware: Mac (slave written by me) - USBtoRS485 - ICPCON tGW-715 (TCPtoRTU gateway) - Win PC (software master) 硬件:Mac(我编写的从属设备)-USBtoRS485-ICPCON tGW-715(TCPtoRTU网关)-Win PC(软件主设备)

When I'm trying this variant: Win PC (software slave) - USBtoRS485 - ICPCON tGW-715 (TCPtoRTU gateway) - Win PC (software master) everything works. 当我尝试此变体时:Win PC(软件从属)-USBtoRS485-ICPCON tGW-715(TCPtoRTU网关)-Win PC(软件主控)一切正常。

Libs: libmodbus, h5.modbus (node.js). 库:libmodbus,h5.modbus(node.js)。 Doesn't matter - correct request, but no response. 没关系-正确的请求,但没有响应。

Target PC (for slave) will be on Linux, so Mac is nearly closer than Win. 目标PC(用于从属)将安装在Linux上,因此Mac几乎比Win更近。

I'm already have no ideas what to check and how to make it work. 我已经不知道要检查什么以及如何使其工作。 What can be wrong? 有什么事吗

The Win PC variant is working so, hardware should be fine. Win PC变体可以正常工作,因此硬件应该可以。 Without more details, I would suggests another approach, if your final goal is to use the system in Linux: use aa virtual machine on Windows, with a Linux guest. 如果您的最终目标是在Linux中使用该系统,那么如果没有更多详细信息,我将建议另一种方法:在Windows上与Linux guest虚拟机一起使用虚拟机。 I work with ICP DAS tech support, and have used VirtualBox with tM-7561 and I-7561 USBtoRS485 converters, with both Linux and Windows hosts. 我与ICP DAS技术支持一起工作,并且将VirtualBox与tM-7561和I-7561 USBtoRS485转换器一起使用,并与Linux和Windows主机一起使用。

I have no experience on Mac, but another option would be trying a Modbus Slave not written by you, for example pyModSlave and see if it works correctly on your Mac, it also shows you the packets sent/received. 我在Mac上没有经验,但是另一种选择是尝试使用非您编写的Modbus从站,例如pyModSlave ,看看它是否在Mac上正常工作,它还会向您显示发送/接收的数据包。

If pyModSlave works correctly on Mac, maybe try a software serial sniffer with your slave. 如果pyModSlave在Mac上可以正常使用,请尝试与从属服务器一起使用软件串行嗅探器。 On Windows I use the one from HHD Software, it has serial, USB and TCP/IP sniffers. 在Windows上,我使用HHD Software的软件,它具有串行,USB和TCP / IP嗅探器。 On Mac/Linux you should be able to use Wireshark to sniff USB communications, but I haven't done that yet personally. 在Mac / Linux上,您应该可以使用Wireshark嗅探USB通信,但是我个人还没有这样做。

Instead of the sniffer, maybe you can use a null modem emulator, so that what you send from a (virtual) serial port will be received on another (virtual) serial port on your Mac, so that you can inspect the data sent/received. 代替嗅探器,也许您可​​以使用空调制解调器仿真器,以便从(虚拟)串行端口发送的内容将在Mac上的另一个(虚拟)串行端口上接收,以便您可以检查发送/接收的数据。 On Windows I use com0com, for Linux there is tty0tty that I haven't used yet. 在Windows上,我使用com0com,对于Linux,我尚未使用过tty0tty Not sure what is available on Mac. 不知道Mac上有什么可用。 Or else just use 2 USBtoRS485 with D+ and D- interconnected, on one port your slave, on the other port a master like qModMaster that shows packets. 否则,只需使用2个Dto和D-互连的USBtoRS485,在从站的一个端口上,在另一个端口上,使用qModMaster这样的主机即可显示数据包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM