edgexfoundry / edgexfoundry/device-modbus-go

String values from Modbus registers return incorrect data due to missing byte/word swap support

Open
#665 4 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
Go
Stars
120
Forks
105
PR merge metrics
No merged PRs in 30d

Description

# Description:

While working with EdgeX Foundry 4.0 and the device-modbus-go service, I encountered an issue when reading string data from a PLC over Modbus.

The PLC sends string data stored in holding/input registers, but the bytes within each register are swapped (which is common in many PLC implementations).

I attempted to use the isByteSwap and isWordSwap configuration options, but they do not work for string data types in the current version. As a result, the strings received in EdgeX are incorrect or unreadable, since the byte order is reversed compared to the actual PLC data.

# Bug Report

Steps to Reproduce:

1) Configure a Modbus device in EdgeX 4.0 that sends string data through holding registers.
2) Define the resource with valueType: "String", and set isByteSwap and isWordSwap to true.
3) Observe the values received by the device service.

Expected:
The string data should match the value sent from the PLC.

Actual:
The received string data is scrambled or contains swapped characters due to byte order mismatch.

# Environment:-

EdgeX Version: 4.0
Service: device-modbus-go
Protocol: Modbus TCP
Device Type: PLC sending string data in holding registers

Contributor guide

Open the contributing guide

Research direction

Start in device-modbus-go by tracing handling for valueType String and the isByteSwap/isWordSwap options when reading holding/input registers over Modbus TCP. Reproduce the PLC byte-order case described in the issue, then verify that the received string matches the expected PLC value.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
embedded-iot, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.