stephane / libmodbus

A Modbus library for Linux, Mac OS, FreeBSD and Windows
http://libmodbus.org
GNU Lesser General Public License v2.1
3.29k stars 1.71k forks source link

Broadcasting when RTU master... #676

Open dnssoftware opened 1 year ago

dnssoftware commented 1 year ago

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

karlp commented 1 year ago

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

bobemoe commented 11 months ago

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 commented 11 months ago

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