apache / apache/nuttx-apps

Modbus not usable with USB serial

Open
#321 0 comments 0 reactions 0 assignees View on GitHub
Type: Enhancement
Dominant language
C
Stars
465
Forks
779
Avg merge
2d 9h
Merged PRs (30d)
36

Description

Modbus can be used with USB serial, however, if the USB serial connection is lost, Modbus will hang in an infinite loop.

This is a problem in the handling of select() and read() and could probably resolved by studying the Modbus error handling.

A more USB-friendly solution would be to: (1) Re-connect and (2) re-open the serial drivers. That is what is done is NSH: When the serial USB device is removed, this terminates the session and NSH will then try to re-open the USB device. See the function nsh_waitusbready() in the file apps/nshlib/nsh_usbconsole.c. When the USB serial is reconnected the open() in the function will succeed and a new session will be started.

This is really an enhancement request: Modbus was never designed to work with removable serial devices.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.