libmodbus icon indicating copy to clipboard operation
libmodbus copied to clipboard

Broadcasting when RTU master...

Open dnssoftware opened this issue 2 years ago • 3 comments

When one is targeting slaves with MODBUS_BROADCAST_ADDRESS and say you issue modbus_write_registers, the code after sending a frame still goes through

if (rc > 0) { uint8_t rsp[MAX_MESSAGE_LENGTH];

    rc = _modbus_receive_msg(ctx, rsp, MSG_CONFIRMATION);
    if (rc == -1)
        return -1;

    rc = check_confirmation(ctx, req, rsp, rc);
}

Shouldn't one bypass waiting for response as one isn't expected?

Regards

Dean

dnssoftware avatar Jan 02 '23 22:01 dnssoftware

in spec, yes, in reality, maybe. I think this should be protected by a quirk mode.

karlp avatar Jan 04 '23 09:01 karlp

In my reality, definitely!

See https://github.com/arduino-libraries/ArduinoModbus/issues/117 where this lib is used on a microcontroller and causing an undesired delay. I have added a PR to that repo but its actually on the exact libmodbus code shown above.

bobemoe avatar Jul 30 '23 09:07 bobemoe

This is actually dupe of #379 which has a PR #467 to fix this!

bobemoe avatar Jul 30 '23 09:07 bobemoe