-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subsys: add MODBUS subsystem #26516
Merged
carlescufi
merged 31 commits into
zephyrproject-rtos:master
from
jfischer-no:pr-modbus-rtu
Mar 19, 2021
Merged
subsys: add MODBUS subsystem #26516
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
270d115
modbus: add MODBUS RTU subsystem
jfischer-no 1c3c28c
CODEOWNERS: add codeowner for modbus
jfischer-no db0d22b
tests: add test for MODBUS RTU subsystem
jfischer-no afbd254
samples: add Modbus RTU server sample
jfischer-no 7251ad4
samples: add Modbus RTU client sample
jfischer-no 7dd18bf
doc: add Modbus RTU documentation
jfischer-no 8721db7
modbus: add control for DE/nRE RS-485 transceiver signals
jfischer-no 47c99ae
modbus: add DE/nRE gpios properties to samples and test
jfischer-no ec59d02
modbus: get interface index according to interface name
jfischer-no 256ff7e
modbus: fix ASCII frame reception and add test for ASCII mode
jfischer-no e941c2c
modbus: reset buffer after reception
jfischer-no 8becbb3
modbus: rename MODBUS RTU API to common MODBUS API
jfischer-no 86879c9
modbus: remove RTU from configuration and headers
jfischer-no 38f8315
modbus: rename mb_rtu_ to modbus_
jfischer-no 51151f0
tests: modbus: remove _rtu_ from modbus test
jfischer-no 5c015f0
modbus: use enum for MODBUS mode
jfischer-no 87f748b
modbus: move MODBUS over serial line code to own file
jfischer-no d2eaf59
modbus: move serial line config outside context
jfischer-no d157027
modbus: make MODBUS support over serial line optional
jfischer-no 0b99009
modbus: rename internal designations and do few minor fixups
jfischer-no 766d36f
modbus: move some RX/TX ADU related code to the core
jfischer-no 7752b88
modbus: return ETIMEDOUT on timeout instead of EIO
jfischer-no 87d50a4
modbus: document return values of internal functions
jfischer-no 828e468
modbus: rework interface configuration
jfischer-no 2290543
modbus: add raw ADU support
jfischer-no bd6f51f
tests: modbus: add raw ADU support test
jfischer-no dc60733
samples: add MODBUS TCP server sample
jfischer-no 6424f1e
samples: modbus: add TCP to serial line gateway
jfischer-no 876a064
doc: modbus: update description and add TCP sample references
jfischer-no cb066a8
samples: rtu_server: rework LED configuration
jfischer-no cda8c30
modbus: rework RS-485 transceiver DE,RE GPIO configuration
jfischer-no File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.. _modbus: | ||
|
||
MODBUS | ||
###### | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
modbus.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.. _modbus_api: | ||
|
||
MODBUS | ||
###### | ||
|
||
Modbus is an industrial messaging protocol. The protocol is specified | ||
for different types of networks or buses. Zephyr OS implementation | ||
supports communication over serial line and may be used | ||
with different physical interfaces, like RS485 or RS232. | ||
TCP support is not implemented directly, but there are helper functions | ||
to realize TCP support according to the application's needs. | ||
|
||
Modbus communication is based on client/server model. | ||
Only one client may be present on the bus. Client can communicate with several | ||
server devices. Server devices themselves are passive and must not send | ||
requests or unsolicited responses. | ||
Services requested by the client are specified by function codes (FCxx), | ||
and can be found in the specification or documentation of the API below. | ||
|
||
Zephyr RTOS implementation supports both client and server roles. | ||
|
||
More information about Modbus and Modbus RTU can be found on the website | ||
`MODBUS Protocol Specifications`_. | ||
|
||
Samples | ||
******* | ||
|
||
`modbus-rtu-server-sample` and `modbus-rtu-client-sample` give | ||
the possibility to try out RTU server and RTU client implementation with | ||
an evaluation board. | ||
|
||
`modbus-tcp-server-sample` is a simple Modbus TCP server. | ||
|
||
`modbus-gateway-sample` is an example how to build a TCP to serial line | ||
gateway with Zephyr OS. | ||
|
||
API Reference | ||
************* | ||
|
||
.. doxygengroup:: modbus | ||
:project: Zephyr | ||
|
||
.. _`MODBUS Protocol Specifications`: https://www.modbus.org/specs.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) 2020 PHYTEC Messtechnik GmbH | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
description: Modbus over serial line device | ||
|
||
compatible: "zephyr,modbus-serial" | ||
|
||
include: uart-device.yaml | ||
|
||
properties: | ||
de-gpios: | ||
type: phandle-array | ||
required: false | ||
description: Driver enable pin. | ||
|
||
Driver enable pin (DE) of the RS-485 transceiver. | ||
If connected directly the MCU pin should be configured | ||
as active high. | ||
|
||
re-gpios: | ||
type: phandle-array | ||
required: false | ||
description: Receiver enable pin. | ||
|
||
Receiver enable pin (nRE) of the RS-485 transceiver. | ||
If connected directly the MCU pin should be configured | ||
as active low. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this might be confusing, as in both provided overlays this signal is actually active low. Perhaps this sentence could be dropped. Similarly in the RE case. For the same reason, "nRE" and "DE" markings in descriptions could be dropped as well. I don't think they actually bring much value.