Re: [Development] modbus over serial port on windows 7 ?

2016-06-02 Thread Karsten Heimrich
Hi,


just a short note, we already added API for overwriting the timeout in 5.7. See 
http://doc-snapshots.qt.io/qt5-5.7/qmodbusrtuserialmaster.html#setInterFrameDelay
 But as seen here 
http://code.qt.io/cgit/qt/qtserialbus.git/tree/src/serialbus/qmodbusrtuserialmaster_p.h#n294
 we missed to update some parts.


--Karsten


From: Development <development-bounces+karsten.heimrich=qt...@qt-project.org> 
on behalf of Denis Shienkov <denis.shien...@gmail.com>
Sent: Thursday, June 2, 2016 4:53:49 PM
Cc: development@qt-project.org
Subject: Re: [Development] modbus over serial port on windows 7 ?

> You can't do that with timing on a non-real-time task.

Quite so! The Modbus spec has been written for the PLC's, where are used the 
Real-Time OS (or for 'bare metal' hardwares).

I have added some ideas, how to avoid it to QTBUG-53767

BR,
Denis


2016-06-02 16:02 GMT+03:00 Thiago Macieira 
<thiago.macie...@intel.com<mailto:thiago.macie...@intel.com>>:
On quinta-feira, 2 de junho de 2016 11:42:27 BRT Alexander Blasche wrote:
> Certain error cases can only be detected if you make assumptions about
> timeouts. Otherwise there is no way to determine where one packet stops and
> where the next one begins.

You can't do that with timing on a non-real-time task. Forget it.

If this bus requires that, make sure to do the packet splitting in a real-time
*kernel* task.

--
Thiago Macieira - thiago.macieira (AT) intel.com<http://intel.com>
  Software Architect - Intel Open Source Technology Center

___
Development mailing list
Development@qt-project.org<mailto:Development@qt-project.org>
http://lists.qt-project.org/mailman/listinfo/development

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] modbus over serial port on windows 7 ?

2016-06-02 Thread Denis Shienkov
> You can't do that with timing on a non-real-time task.

Quite so! The Modbus spec has been written for the PLC's, where are used
the Real-Time OS (or for 'bare metal' hardwares).

I have added some ideas, how to avoid it to QTBUG-53767

BR,
Denis


2016-06-02 16:02 GMT+03:00 Thiago Macieira :

> On quinta-feira, 2 de junho de 2016 11:42:27 BRT Alexander Blasche wrote:
> > Certain error cases can only be detected if you make assumptions about
> > timeouts. Otherwise there is no way to determine where one packet stops
> and
> > where the next one begins.
>
> You can't do that with timing on a non-real-time task. Forget it.
>
> If this bus requires that, make sure to do the packet splitting in a
> real-time
> *kernel* task.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> ___
> Development mailing list
> Development@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] modbus over serial port on windows 7 ?

2016-06-02 Thread Thiago Macieira
On quinta-feira, 2 de junho de 2016 11:42:27 BRT Alexander Blasche wrote:
> Certain error cases can only be detected if you make assumptions about
> timeouts. Otherwise there is no way to determine where one packet stops and
> where the next one begins.

You can't do that with timing on a non-real-time task. Forget it.

If this bus requires that, make sure to do the packet splitting in a real-time 
*kernel* task.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] modbus over serial port on windows 7 ?

2016-06-02 Thread Alexander Blasche


> -Original Message-
> From: Development [mailto:development-
> bounces+alexander.blasche=qt...@qt-project.org] On Behalf Of Denis Shienkov
> Sent: Thursday, 2 June 2016 7:11
> To: development@qt-project.org
> Subject: Re: [Development] modbus over serial port on windows 7 ?
> 
> > only the value of around 50ms gives a stable result in my case.
> 
> Hehh.. I warned the QtSerialBus team that introduction of 3.5 timeouts will 
> lead
> to bugs and that it doesn't make sense (though, it is described in the Modbus
> specification).

> We do not need to rely on this 'characters timeouts', because the
> OS can not provide this precision timeout (besides, Qt5 event loop introduces
> also an delay). But, nobody haven't listened to me.

Denis, that's a nice simplistic viewpoint but does not work for Modbus and 
comments like the above do not help either. 
Certain error cases can only be detected if you make assumptions about 
timeouts. Otherwise there is no way to determine where one packet stops and 
where the next one begins. We are dealing with contradicting requirements on 
protocol and OS level.

Obviously the current point is not optimal. We have to tweak more. Let's see 
what we can manage in QTBUG-53767. Please shift this discussion to the bug now. 
Thank you.

--
Alex
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] modbus over serial port on windows 7 ?

2016-06-01 Thread Denis Shienkov

> only the value of around 50ms gives a stable result in my case.

Hehh.. I warned the QtSerialBus team that introduction of 3.5 timeouts 
will lead to bugs and that it doesn't make sense (though, it is 
described in the Modbus specification). We do not need to rely on this 
'characters timeouts', because the OS can not provide this precision 
timeout (besides, Qt5 event loop introduces also an delay). But, nobody 
haven't listened to me.


BR,

Denis


01.06.2016 20:59, Dmitry Shapovalov пишет:
Okay. I think i found the source of problem. Calculation of send 
timeout is incorrect.


Here is the calculation code:

http://code.qt.io/cgit/qt/qtserialbus.git/tree/src/serialbus/qmodbusrtuserialmaster_p.h#n294

// Example: 9600 baud, 11 bit per packet -> 872 char/sec
// so: 1000 ms / 872 char = 1.147 ms/char * 3.5 character
m_sendTimer.start((1000. / (qreal(m_baudRate) / 11.)) * 
m_current.adu.size());


Which in my case (115200 and 8 bytes of data) gives 0.7 ms. And after 
conversion to int, it becomes zero.

So m_sendTimer is fired up immediately, which brings us to to this code:

http://code.qt.io/cgit/qt/qtserialbus.git/tree/src/serialbus/qmodbusrtuserialmaster_p.h#n323

} else if (m_current.bytesWritten < m_current.adu.size()) {
qCDebug(QT_MODBUS) << "(RTU client) Send failed:" << 
m_current.requestPdu;


if (m_current.numberOfRetries <= 0) {
if (m_current.reply) {
m_current.reply->setError(QModbusDevice::TimeoutError,
QModbusClient::tr("Request timeout."));
}
So there comes a premature timeout.

I experimented with a timeout and found that even a value of 15-20ms 
does not give stable results. only the value of around 50ms gives a 
stable result in my case.
I suppose that timeout calculation must include some additional 
minimum time constant.


I will report this bug.

Thank you all for the help )

2016-05-31 17:15 GMT+05:00 Ralf Nolden >:


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 0x0104000131ca and 0x0104024c494c06 are
correct
> > request and response.
> >
> >
> > 2016-05-31 15:05 GMT+05:00 Denis Shienkov

> >
> > >>:
> > 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: 0x040001
> >> qt.modbus.lowlevel: (RTU client) Sent Serial ADU:
0x0104000131ca
> >> qt.modbus: (RTU client) Send failed: 0x040001
> >> qt.modbus: 

Re: [Development] modbus over serial port on windows 7 ?

2016-06-01 Thread Dmitry Shapovalov
Okay. I think i found the source of problem. Calculation of send timeout is
incorrect.

Here is the calculation code:

http://code.qt.io/cgit/qt/qtserialbus.git/tree/src/serialbus/qmodbusrtuserialmaster_p.h#n294

// Example: 9600 baud, 11 bit per packet -> 872 char/sec
// so: 1000 ms / 872 char = 1.147 ms/char * 3.5 character
m_sendTimer.start((1000. / (qreal(m_baudRate) / 11.)) *
m_current.adu.size());

Which in my case (115200 and 8 bytes of data) gives 0.7 ms. And after
conversion to int, it becomes zero.
So m_sendTimer is fired up immediately, which brings us to to this code:

http://code.qt.io/cgit/qt/qtserialbus.git/tree/src/serialbus/qmodbusrtuserialmaster_p.h#n323

} else if (m_current.bytesWritten < m_current.adu.size()) {
qCDebug(QT_MODBUS) << "(RTU client) Send failed:" <<
m_current.requestPdu;

if (m_current.numberOfRetries <= 0) {
if (m_current.reply) {

m_current.reply->setError(QModbusDevice::TimeoutError,
QModbusClient::tr("Request timeout."));
}

So there comes a premature timeout.

I experimented with a timeout and found that even a value of 15-20ms does
not give stable results. only the value of around 50ms gives a stable
result in my case.
I suppose that timeout calculation must include some additional minimum
time constant.

I will report this bug.

Thank you all for the help )

2016-05-31 17:15 GMT+05:00 Ralf Nolden :

> 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 0x0104000131ca and 0x0104024c494c06 are correct
> > > request and response.
> > >
> > >
> > > 2016-05-31 15:05 GMT+05:00 Denis Shienkov  > >
> > > >:
> > > 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: 0x040001
> > >> qt.modbus.lowlevel: (RTU client) Sent Serial ADU:
> 0x0104000131ca
> > >> qt.modbus: (RTU client) Send failed: 0x040001
> > >> 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  > 

Re: [Development] modbus over serial port on windows 7 ?

2016-05-31 Thread Ralf Nolden
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 0x0104000131ca and 0x0104024c494c06 are correct
> > request and response.
> > 
> > 
> > 2016-05-31 15:05 GMT+05:00 Denis Shienkov  > 
> > >:
> > 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: 0x040001
> >> qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x0104000131ca
> >> qt.modbus: (RTU client) Send failed: 0x040001
> >> 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  >> 
> >> >:
> >> 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
> >> 
> >> 

Re: [Development] modbus over serial port on windows 7 ?

2016-05-31 Thread 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.


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 0x0104000131ca and 0x0104024c494c06 are correct 
request and response.



2016-05-31 15:05 GMT+05:00 Denis Shienkov >:


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-Desktop_Qt_5_6_0_MinGW_32bit-Debug\debug\modbusmaster.exe...
qt.modbus: (RTU client) Sent Serial PDU: 0x040001
qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x0104000131ca
qt.modbus: (RTU client) Send failed: 0x040001
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 >:

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@qt-project.org 
http://lists.qt-project.org/mailman/listinfo/development




-- 
-- 
With Best Regards

Dmitry Shapovalov


___
Development mailing list
Development@qt-project.org 
http://lists.qt-project.org/mailman/listinfo/development



___
Development mailing list
Development@qt-project.org 
http://lists.qt-project.org/mailman/listinfo/development




--
--
With Best Regards
Dmitry Shapovalov


___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] modbus over serial port on windows 7 ?

2016-05-31 Thread 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 0x0104000131ca and 0x0104024c494c06 are correct
request and response.


2016-05-31 15:05 GMT+05:00 Denis Shienkov :

> 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-Desktop_Qt_5_6_0_MinGW_32bit-Debug\debug\modbusmaster.exe...
> qt.modbus: (RTU client) Sent Serial PDU: 0x040001
> qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x0104000131ca
> qt.modbus: (RTU client) Send failed: 0x040001
> 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 :
>
>> 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@qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/development
>>
>
>
>
> --
> --
> With Best Regards
> Dmitry Shapovalov
>
>
> ___
> Development mailing 
> listDevelopment@qt-project.orghttp://lists.qt-project.org/mailman/listinfo/development
>
>
>
> ___
> Development mailing list
> Development@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>
>


-- 
--
With Best Regards
Dmitry Shapovalov
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] modbus over serial port on windows 7 ?

2016-05-31 Thread Denis Shienkov

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-Desktop_Qt_5_6_0_MinGW_32bit-Debug\debug\modbusmaster.exe...

qt.modbus: (RTU client) Sent Serial PDU: 0x040001
qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x0104000131ca
qt.modbus: (RTU client) Send failed: 0x040001
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 >:


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@qt-project.org 
http://lists.qt-project.org/mailman/listinfo/development




--
--
With Best Regards
Dmitry Shapovalov


___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] modbus over serial port on windows 7 ?

2016-05-31 Thread Ralf Nolden
Am Dienstag, 31. Mai 2016, 14:23:42 schrieb 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-Desktop_Qt_5
> _6_0_MinGW_32bit-Debug\debug\modbusmaster.exe... qt.modbus: (RTU client)
> Sent Serial PDU: 0x040001
> qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x0104000131ca
> qt.modbus: (RTU client) Send failed: 0x040001
> 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.
The sending failed due to your log, then there is no open request that the 
response which you seem to get can be matched.

You could also use a serial port sniffer to log the data transfer in parallel 
and check what is sent and received on the port.

Anyway, from your output of the response buffer, you seem to get the requested 
value back:
- slave id 1
- function code 4
- 2 bytes data to follow
- value 4c49
- crc 4c06 (correct)

Can you confirm the same string with your other tools and maybe try more than 
one value ? Your problem seems to be related to your error message above which 
I can't interpret due to missing language skills :)




> 
> 2016-05-31 11:59 GMT+05:00 Ralf Nolden :
> > 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@qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/development

-- 
Kind regards,

Ralf Nolden

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] modbus over serial port on windows 7 ?

2016-05-31 Thread 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-Desktop_Qt_5_6_0_MinGW_32bit-Debug\debug\modbusmaster.exe...
qt.modbus: (RTU client) Sent Serial PDU: 0x040001
qt.modbus.lowlevel: (RTU client) Sent Serial ADU: 0x0104000131ca
qt.modbus: (RTU client) Send failed: 0x040001
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 :

> 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@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>



-- 
--
With Best Regards
Dmitry Shapovalov
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] modbus over serial port on windows 7 ?

2016-05-31 Thread Ralf Nolden
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@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


[Development] modbus over serial port on windows 7 ?

2016-05-30 Thread Dmitry Shapovalov
Hello,
can someone confirm that modbus over serial port is working on windows ?
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 ?

-- 
--
With Best Regards
Dmitry Shapovalov
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development