Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-62192

MODBUS custom command doesn't work

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3: Somewhat important
    • Resolution: Invalid
    • Affects Version/s: 5.9.1
    • Fix Version/s: 5.15.4, 6.2.0 Alpha
    • Component/s: SerialBus: MOD Bus
    • Labels:
      None
    • Commits:
      2c0bb738e988d84f36169e0103d051745b678479 (qt/qtserialbus/dev) 17ac276e9b4fcde0f2e2b9a68a01ef6cdde31cf5 (qt/tqtc-qtserialbus/tqtc/lts-5.15)

      Description

       I'm trying to send custom MODBUS request but each time I get an empty data in reply, although I see the correct result in the logs (ADU, PDU).

          auto cmd = QModbusPdu::FunctionCode(0x42);
          auto request = QModbusRequest(cmd, QByteArray::fromHex("00080f"));
          QModbusRequest::registerDataSizeCalculator(
                      cmd,
                      [](const QModbusRequest &)->int {
              return 19;
          });
          /*
             request.registerDataSizeCalculator(
                      cmd,
                      [](const QModbusRequest &)->int {
              return 19;
          });
          */
      
      ... send rawRequest ...
      
      qDebug() << "data"
               << reply->rawResult().data()
               << "code"
               << reply->rawResult().functionCode();
      
      // data "" code 0
      

        Attachments

        For Gerrit Dashboard: QTBUG-62192
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            heimrich Karsten Heimrich
            Reporter:
            uralbash Dmitry S
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes