简体   繁体   English

重新连接 RS232/RS485 适配器后 Modbus RTU 设备超时

[英]Timeout Modbus RTU Devices after reconnect RS232/RS485 Adapter

I've problems with a MODBUS RTU connection to devices after a disconnect & reconnect of the RS232.断开并重新连接 RS232 后,MODBUS RTU 与设备的连接出现问题。 The system is build up the following way:该系统的构建方式如下:

  • MODBUS RTU device with A+ & B- clamps (no C = GND available, eg electricity meter SDM120, but problem also appears on other device types)带有 A+ 和 B- 夹具的 MODBUS RTU 设备(没有 C = GND 可用,例如电表 SDM120,但问题也会出现在其他设备类型上)
  • RS485 wires A & B RS485 线 A & B
  • Adapter RS232 -> RS485 DA-70161 based on SP485EE chip适配器 RS232 -> RS485 DA-70161 基于 SP485EE 芯片
  • RS232 cable with DSUB9 connector带 DSUB9 连接器的 RS232 电缆
  • UART connected MAX3243 chip for RS232 with CTS/RTS UART 连接 MAX3243 芯片,用于带有 CTS/RTS 的 RS232
  • libmodbus software using /dev/ttymxc0 configured for 9600baud 8N1 (fitting to device defaults) libmodbus 软件使用 /dev/ttymxc0 配置为 9600baud 8N1(适合设备默认值)
  • Linux kernel 4.4.0 embedded ARM CPU Linux内核4.4.0嵌入式ARM CPU

In general this works fine, even over weeks.一般来说,这可以正常工作,甚至可以持续数周。 But once one disconnects the RS232 cable and reconnects it after some seconds (or minutes or hours), the libmodbus gets timeout-errors on every access to the MODBUS device.但是,一旦断开 RS232 电缆并在几秒钟(或几分钟或几小时)后重新连接,libmodbus 在每次访问 MODBUS 设备时都会出现超时错误。 This is very annoying, because it is difficult to get it back to work again.这很烦人,因为很难让它再次工作。 Only a lot of further disconnects of both ends of the RS232-RS485-Adapter will bring it back, after some minutes and up to 10 retries.只有在 RS232-RS485 适配器的两端进一步断开连接才能在几分钟和最多 10 次重试后将其恢复。

Any idea what could cause this problem?知道什么可能导致这个问题吗?

Any help what to do to prevent this and immediately work after reconnect the RS232 cable?有什么帮助可以防止这种情况发生并在重新连接 RS232 电缆后立即工作?

(Yes, one possible solution is to simply let the RS232 cable be always connected. But sometime somebody need to do something and forgot about the consequences - I think this is not a realistic option) (是的,一种可能的解决方案是简单地让 RS232 电缆始终连接。但有时有人需要做某事而忘记了后果 - 我认为这不是一个现实的选择)

I've got an solution, with help of mikrocontroller.net forum:我有一个解决方案,在mikrocontroller.net论坛的帮助下:

Using another RS232 → RS485 adapter DeLock 62919 and powering with +5V on the clamps by dedicated power-supply, did the job!使用另一个 RS232 → RS485 适配器 DeLock 62919 并通过专用电源为夹子上的 +5V 供电,完成了工作!

Now the communication comes up again, even after RS232 was un- and replugged现在通信再次出现,即使在 RS232 被拔下并重新插入之后

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

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