samples/subsys/modbus/rtu_client/README.html · samples/subsys/modbus/rtu_client/README.rst 공식 원문 ↗

Zephyr 3.7.0 · Samples · Modbus · RTU Client

Modbus RTU 클라이언트

DE 제어와 RS-485 배선을 구성하고 RTU server의 register·LED를 순차 제어합니다.

Official pathsamples/subsys/modbus/rtu_client/README.html
Source filesamples/subsys/modbus/rtu_client/README.rst
Source versionZephyr 3.7.0
TranslationFull · reviewed

본문 기준: Zephyr 3.7.0 LTS3 · 이후 유지보수 패치는 별도입니다.

Part 1

요약·해설

FRDM-K64F RTU client build와 RS-485 shield wiring, holding register·coil output을 설명합니다.

Link

UART → RS-485

Boards

nRF52840 DK · FRDM-K64F

Result

Holding register · Coils · LEDs

Part 2

접을 수 있는 영어 원문 전체

영어 원문 전체 펼치기
원문 SHA-256 7A0930C3C97A9158FDFC389D3CAB0FEE5BEFBD8D6A71B577285C9CA32F4BA542
.. zephyr:code-sample:: modbus-rtu-client
   :name: Modbus RTU client
   :relevant-api: modbus

   Communicate with a Modbus RTU server.

Overview
********

This is a simple application demonstrating a Modbus RTU client implementation
in Zephyr RTOS.

Requirements
************

This sample has been tested with the nRF52840-DK and FRDM-K64F boards,
but it should work with any board that has a free UART interface.

RTU client example is running on an evaluation board and communicates
with another board running the :zephyr:code-sample:`modbus-rtu-server` sample.

In addition to the evaluation board a RS-485 shield may be used.
The shield converts UART TX, RX signals to RS-485.
An Arduino header compatible shield like `joy-it RS-485 shield for Arduino`_
can be used. This example uses DE signal, which is controlled by pin D9
on the JOY-IT shield. For other shields, ``de-gpios`` property must be adapted
or removed in the application overlay file
:zephyr_file:`samples/subsys/modbus/rtu_client/app.overlay`

The A+, B- lines of the RS-485 shields should be connected together.

Alternatively UART RX,TX signals of two boards can be connected crosswise.

Building and Running
********************

This sample can be found under
:zephyr_file:`samples/subsys/modbus/rtu_client` in the Zephyr tree.

The following commands build and flash RTU client sample.

.. zephyr-app-commands::
   :zephyr-app: samples/subsys/modbus/rtu_client
   :board: frdm_k64f
   :goals: build flash
   :compact:

The example communicates with the RTU server and lets the LEDs light up
one after the other.

.. code-block:: console

   *** Booting Zephyr OS build zephyr-v2.3.0-1993-g07e8d80ae028  ***
   [00:00:00.005,000] <inf> mb_rtu: RTU timeout 2005 us
   [00:00:00.050,000] <inf> mbc_sample: WR|RD holding register:
   48 00 65 00 6c 00 6c 00  6f 00 00 00 00 00 00 00 |H.e.l.l. o.......
   [00:00:00.062,000] <inf> mbc_sample: Coils state 0x00
   [00:00:00.864,000] <inf> mbc_sample: Coils state 0x07


.. _`joy-it RS-485 shield for Arduino`: https://joy-it.net/en/products/ARD-RS485

Part 3

한국어 전문 번역

개요

Zephyr RTOS의 Modbus RTU client 구현을 보여 주는 간단한 application입니다.

요구 사항

이 sample은 nRF52840 DK와 FRDM-K64F에서 시험되었지만, 사용 가능한 UART interface가 있는 board라면 동작할 수 있습니다. Evaluation board의 RTU client는 다른 board에서 실행 중인 Modbus RTU server sample과 통신합니다.

Evaluation board에 RS-485 shield를 더할 수 있습니다. Shield는 UART TX·RX signal을 RS-485 differential signal로 변환합니다. Arduino header와 호환되는 Joy-IT RS-485 shield를 사용할 수 있으며, 이 example은 shield의 D9 pin으로 제어되는 DE signal을 사용합니다.

다른 shield에서는 application overlay samples/subsys/modbus/rtu_client/app.overlay의 de-gpios property를 해당 pin에 맞게 바꾸거나 필요 없으면 제거합니다. 두 RS-485 shield의 A+와 B- line을 각각 연결합니다. RS-485 transceiver 대신 board 두 개의 UART RX와 TX를 교차 연결할 수도 있습니다.

빌드 및 실행

Sample은 Zephyr tree의 samples/subsys/modbus/rtu_client에 있습니다. 다음 command는 FRDM-K64F용 RTU client를 build하고 flash합니다.

west build -b frdm_k64f samples/subsys/modbus/rtu_client
west flash

Client는 RTU server와 통신하면서 holding register를 쓰고 읽으며, coil state를 바꿔 server board의 LED가 차례로 켜지게 합니다. Output에는 계산된 RTU timeout, Hello가 들어간 holding register hexdump, 처음 0x00이던 coil state가 0x07로 바뀐 결과가 표시됩니다.

*** Booting Zephyr OS build zephyr-v2.3.0-1993-g07e8d80ae028  ***
[00:00:00.005,000] <inf> mb_rtu: RTU timeout 2005 us
[00:00:00.050,000] <inf> mbc_sample: WR|RD holding register:
48 00 65 00 6c 00 6c 00  6f 00 00 00 00 00 00 00 |H.e.l.l. o.......
[00:00:00.062,000] <inf> mbc_sample: Coils state 0x00
[00:00:00.864,000] <inf> mbc_sample: Coils state 0x07

Source

출처

영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.