Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Modbus problems when console is connected
Forum Updated to NodeBB v4.3 + New Features

Modbus problems when console is connected

Scheduled Pinned Locked Moved Unsolved General and Desktop
modbusconsolewidgetsserialbus
1 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kalamondin
    wrote on 27 Nov 2018, 14:04 last edited by kalamondin
    #1

    Hello,
    I came across a strange situation while developing modbus client application. I wanted to connect console to my application for debugging purposes, but it seems to somehow mess with modbus module.
    On connection with modbus server I send a read request . When I run the application in Qt Creator without console in .pro file I get following results (in Qt Creator built-in console):

    qt.modbus: (RTU client) Sent Serial PDU: 0x0300000026
    qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x310300000026c1e0
    qt.modbus: (RTU client) Send successful: 0x0300000026
    qt.modbus.lowlevel: (RTU client) Response buffer: "31034c55010102000100025c10761009c2988015f25bf4494d204f59535f4d534d36533830000000000000000000000000000000000000000000000000000000000000000000000000000000000000c8"
    qt.modbus: (RTU client) Incomplete ADU received, ignoring
    qt.modbus.lowlevel: (RTU client) Response buffer: "31034c55010102000100025c10761009c2988015f25bf4494d204f59535f4d534d36533830000000000000000000000000000000000000000000000000000000000000000000000000000000000000c842"
    qt.modbus: (RTU client) Received ADU: "31034c55010102000100025c10761009c2988015f25bf4494d204f59535f4d534d36533830000000000000000000000000000000000000000000000000000000000000000000000000000000000000c842" 
    

    After adding console to config in .pro file, the application fails to get a correct response from the server:

    qt.modbus: (RTU client) Sent Serial PDU: 0x0300000026
    qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x310300000026c1e0
    qt.modbus: (RTU client) Send failed: 0x0300000026
    qt.modbus: (RTU client) Sent Serial PDU: 0x0300000026
    qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x310300000026c1e0
    qt.modbus: (RTU client) Send failed: 0x0300000026
    qt.modbus: (RTU client) Sent Serial PDU: 0x0300000026
    qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x310300000026c1e0
    qt.modbus.lowlevel: (RTU client) Response buffer: "42"
    qt.modbus: (RTU client) Modbus ADU not complete
    qt.modbus: (RTU client) Send failed: 0x0300000026
    qt.modbus.lowlevel: (RTU client) Response buffer: "4231034c55010102000100025c10761009c2988015f25bf4494d204f59535f4d534d36533830000000000000000000000000000000000000000000000000000000000000000000000000000000000000c8"
    qt.modbus: (RTU client) Cannot calculate PDU size for function code: 49 , delaying pending frame
    qt.modbus.lowlevel: (RTU client) Response buffer: "4231034c55010102000100025c10761009c2988015f25bf4494d204f59535f4d534d36533830000000000000000000000000000000000000000000000000000000000000000000000000000000000000c842"
    qt.modbus: (RTU client) Cannot calculate PDU size for function code: 49 , delaying pending frame
    

    Is it possible that adding console impacts modbus module somehow? Or am i missing something?
    I'm not changing anything in code apart from CONFIG += console in .pro file.
    I run the application in debug mode, using QT 5.11.2 (Windows 10)

    Thanks in advance for any help.

    Edit: During further investigation I checked the same scenario on Qt modbus master example and the behaviour was similar:

    qt.modbus: (RTU client) Sent Serial PDU: 0x030000000a
    qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x31030000000ac03d
    qt.modbus: (RTU client) Send failed: 0x030000000a
    qt.modbus: (RTU client) Sent Serial PDU: 0x030000000a
    qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x31030000000ac03d
    qt.modbus: (RTU client) Send failed: 0x030000000a
    qt.modbus.lowlevel: (RTU client) Response buffer: "31031455010102000100025c10761009c2988015f25bf4f595"
    qt.modbus: (RTU client) Received ADU: "31031455010102000100025c10761009c2988015f25bf4f595"
    qt.modbus: (RTU client) Sent Serial PDU: 0x030000000a
    qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x31030000000ac03d
    qt.modbus.lowlevel: (RTU client) Response buffer: "31031455010102000100025c10761009c2988015f25bf4f595"
    qt.modbus: (RTU client) Received ADU: "31031455010102000100025c10761009c2988015f25bf4f595"
    qt.modbus: (RTU client) Send failed: 0x030000000a
    qt.modbus.lowlevel: (RTU client) Response buffer: "31031455010102000100025c10761009c2988015f25bf4f595"
    qt.modbus: (RTU client) Received ADU: "31031455010102000100025c10761009c2988015f25bf4f595"
    qt.modbus: (RTU client) Cannot match response with open request, ignoring
    

    QModbusRtuSerialMaster sends correct data (I used serial port sniffer to check data flow), but incorrectly assumes send was unsuccessful (qt.modbus: (RTU client) Send failed), so even when it gets correct response it cannot associate it with any request and therefore ignores it. That's the result I get maybe 95% times, every once in a while it manages to work correctly. Without console everything works fine. Can anyone replicate this issue on their setup? Thanks

    1 Reply Last reply
    0

    1/1

    27 Nov 2018, 14:04

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved