[Development] modbus over serial port on windows 7 ?

Ralf Nolden nolden at kde.org
Tue May 31 14:15:15 CEST 2016


Am Dienstag, 31. Mai 2016, 13:53:15 schrieb Denis Shienkov:
>  > But why ?
> 
> I don't know.. maybe the Qt Modbus Master closes the connection without
> waiting of data send,
> 
> maybe something else..
> 
> PS: I just have checked the QSerialPort autotests with the PL2303 on
> Windows - all worked.
> 
> PS2: You can try to use the Terminal Example (from the Qt Serial Port)
> with the Rx/Tx connected,
> 
> to check that your serial port works.

If you have a second PC around, try running the slave example there and 
connect them with a second adapter, then try the master example to see if your 
conection works between those two computers.

At any rate. the modbus master is doing the right thing if the error comes 
from the serial port. We can't just ignore port errors in cases where the 
returned response theoretically matches the expected results :)

> 
> 31.05.2016 13:17, Dmitry Shapovalov пишет:
> > Yep. That's right. It is ERROR_OPERATION_ABORTED.
> > But why ? Any other application works as expected with this hardware.
> > 
> > And i confirm that 0x01040000000131ca and 0x0104024c494c06 are correct
> > request and response.
> > 
> > 
> > 2016-05-31 15:05 GMT+05:00 Denis Shienkov <denis.shienkov at gmail.com
> > 
> > <mailto:denis.shienkov at gmail.com>>:
> >     Seems, this:
> >     > qt.modbus: (RTU server) QSerialPort error:
> >     > QSerialPort::SerialPortError(ResourceError) "Операция>     
> >     ввода/вывода была прервана из-за завершения потока команд или по
> >     запросу приложения."
> >     
> >     It is an 'ERROR_OPERATION_ABORTED', that can be caused by
> >     
> >     ::CancelIo() (e.g. when the serial port closes) or by a HW problems.
> >     
> >     BR,
> >     
> >     Denis
> >     
> >     31.05.2016 12:23, Dmitry Shapovalov пишет:
> >>     Thanks for reply Ralf. Email more preferable for me.
> >>     
> >>     Can you tell me what type of adapter you are using? Which version
> >>     of qtserialport are you using? Maybe my problem is related to the
> >>     type of serial port adapter. I tried use arduino with different
> >>     usb-uart chips(ch430 and pl2303), but unsuccessfully.
> >>     
> >>     Here is output of qt modbus master example
> >>     
> >>     Запускается
> >>     C:\Qt\Examples\Qt-5.6\qtserialbus\serialbus\modbus\build-master-Deskt
> >>     op_Qt_5_6_0_MinGW_32bit-Debug\debug\modbusmaster.exe... qt.modbus:
> >>     (RTU client) Sent Serial PDU: 0x0400000001
> >>     qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x01040000000131ca
> >>     qt.modbus: (RTU client) Send failed: 0x0400000001
> >>     qt.modbus: (RTU server) QSerialPort error:
> >>     QSerialPort::SerialPortError(ResourceError) "Операция
> >>     ввода/вывода была прервана из-за завершения потока команд или по
> >>     запросу приложения."
> >>     qt.modbus.lowlevel: (RTU client) Response buffer: "01"
> >>     qt.modbus: (RTU client) Modbus ADU not complete
> >>     qt.modbus.lowlevel: (RTU client) Response buffer: "0104024c494c06"
> >>     qt.modbus: (RTU client) Received ADU: "0104024c494c06"
> >>     qt.modbus: (RTU client) Cannot match response with open request,
> >>     ignoring
> >>     
> >>     Look like it actually sends request, but qtserialport reports
> >>     error, so qtserialbus(modbus) ignores response.
> >>     
> >>     
> >>     2016-05-31 11:59 GMT+05:00 Ralf Nolden <nolden at kde.org
> >>     
> >>     <mailto:nolden at kde.org>>:
> >>         Am Dienstag, 31. Mai 2016, 09:34:19 schrieb Dmitry Shapovalov:
> >>         > Hello,
> >>         > can someone confirm that modbus over serial port is working
> >>         
> >>         on windows ?
> >>         I have tested modbus over serial port on windows with two
> >>         Schneider Electric
> >>         PLCs, a Twido and a Premium, both with TCP and RS485. We
> >>         could evaluate your
> >>         problems on IRC if you want.
> >>         
> >>         > all my experiments led me to the thought that it is
> >>         
> >>         absolutely broken.
> >>         
> >>         > i am using arduno as a modbus device. i tested it with
> >>         
> >>         qmodbus and modbus
> >>         
> >>         > poll. works great. but when i try to use modbus examples from
> >>         > qt(qtserialbus/examples/serialbus/modbus/master), look like
> >>         
> >>         it can not send
> >>         
> >>         > request.
> >>         > i tried release(5.6) and git version of qtserialbus and
> >>         
> >>         qtserialport
> >>         
> >>         > modules with no luck.
> >>         > 
> >>         > i am using windows 7 on virtualbox.
> >>         > arduino modbus library from here
> >>         > https://github.com/smarmengol/Modbus-Master-Slave-for-Arduino
> >>         > arduino sketch http://pastebin.com/FHW3B7TX
> >>         > 
> >>         > it's me or it's really broken ?
> >>         
> >>         --
> >>         Kind regards,
> >>         
> >>         Ralf Nolden
> >>         
> >>         _______________________________________________
> >>         Development mailing list
> >>         Development at qt-project.org <mailto:Development at qt-project.org>
> >>         http://lists.qt-project.org/mailman/listinfo/development
> >>     
> >>     _______________________________________________
> >>     Development mailing list
> >>     Development at qt-project.org <mailto:Development at qt-project.org>
> >>     http://lists.qt-project.org/mailman/listinfo/development
> >     
> >     _______________________________________________
> >     Development mailing list
> >     Development at qt-project.org <mailto:Development at qt-project.org>
> >     http://lists.qt-project.org/mailman/listinfo/development
> > 
> > _______________________________________________
> > Development mailing list
> > Development at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/development

-- 
Kind regards,

Ralf Nolden




More information about the Development mailing list