<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QSerialPort Qt5.9.1 issue]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">i am facing an issue on QSerialPort. In Qt5.7.1 works fine but on Qt5.9.1 it is not receiving all values i am sending.<br />
The code is the same and i am only changing the kits/version from 5.7.1 to 5.9.1.</p>
<p dir="auto">What i am doing is waiting so that bytes available are equal or greater than 160 and i will only read 160  bytes.<br />
Here is my code:</p>
<pre><code>if(serial-&gt;bytesAvailable()&gt;=160)
{
        num=serial-&gt;read(buffer,160);

        if((num != -1) &amp;&amp; num)
       {
             QByteArray DSI_Array = QByteArray(buffer, 160);
             ...
</code></pre>
<p dir="auto">Any idea? Is tehre a known issue on QSerialPort in Qt5.9.1?</p>
]]></description><link>https://forum.qt.io/topic/91388/qserialport-qt5-9-1-issue</link><generator>RSS for Node</generator><lastBuildDate>Tue, 13 Oct 2026 01:15:58 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/91388.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 06 Jun 2018 08:45:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QSerialPort Qt5.9.1 issue on Wed, 06 Jun 2018 09:19:59 GMT]]></title><description><![CDATA[<p dir="auto">Ok so this resolve my issue<br />
Instead of</p>
<pre><code>if(serial-&gt;bytesAvailable()&gt;=160)
</code></pre>
<p dir="auto">I change it to</p>
<pre><code>while(serial-&gt;bytesAvailable()&gt;=160)
</code></pre>
<p dir="auto">So if buffer has more values it should read them too. Once is less then 160 bytes, it will leave the slot. It iwll come back when "readyRead" signal is emitted again.</p>
]]></description><link>https://forum.qt.io/post/462160</link><guid isPermaLink="true">https://forum.qt.io/post/462160</guid><dc:creator><![CDATA[michaelL]]></dc:creator><pubDate>Wed, 06 Jun 2018 09:19:59 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort Qt5.9.1 issue on Wed, 06 Jun 2018 09:15:42 GMT]]></title><description><![CDATA[<p dir="auto">I dont know if this is causing the issue:</p>
<p dir="auto">void QIODevice::readyRead():<br />
" you should always emit readyRead() when new data has arrived (do not emit it only because there's data still to be read in your buffers"</p>
<p dir="auto">Everything was working with Qt5.7.1. Maybe i have to make a new loop to check if buffer still has values more ore equal than 160. If so, it should be read them, because the signal "readyRead()" wont be send out again.</p>
]]></description><link>https://forum.qt.io/post/462157</link><guid isPermaLink="true">https://forum.qt.io/post/462157</guid><dc:creator><![CDATA[michaelL]]></dc:creator><pubDate>Wed, 06 Jun 2018 09:15:42 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort Qt5.9.1 issue on Wed, 06 Jun 2018 09:06:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/aha_1980">@<bdi>aha_1980</bdi></a>  so i am reading in a slot</p>
<pre><code>connect(serial, &amp;QSerialPort::readyRead, this, &amp;QelcSystemSerialport::run);
</code></pre>
<p dir="auto">Everytime QSerialPort send "readyRead" it goes to slot "run"</p>
<p dir="auto">A MCU is sending values to Qt Application. I debug MCu and it is sending, i measured the RX and TX with an oscilloscope and the values are send out.<br />
So the issue is in Qt</p>
]]></description><link>https://forum.qt.io/post/462153</link><guid isPermaLink="true">https://forum.qt.io/post/462153</guid><dc:creator><![CDATA[michaelL]]></dc:creator><pubDate>Wed, 06 Jun 2018 09:06:18 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort Qt5.9.1 issue on Wed, 06 Jun 2018 09:01:19 GMT]]></title><description><![CDATA[<p dir="auto">So looking in the read part if i do:</p>
<p dir="auto">QByteArray Array=serial-&gt;readAll();<br />
it really does receive all bytes but the issue is when i want to read a specific amount of bytes like 160 and not all:</p>
<p dir="auto">So everytime i do this:<br />
serial-&gt;read(buffer,160);</p>
<p dir="auto">The QSerialPort buffer "erase" all bytes that where read from "read()" function plus the left ones inside.</p>
<p dir="auto">Why is the internal QSerialPort buffer been completely erased if i do  "read(buffer,160);"<br />
I understand if i do "readAll()" it will read all values from serialport and delete them.<br />
But why is "read()" function doing the same in Qt5.9.1?</p>
]]></description><link>https://forum.qt.io/post/462150</link><guid isPermaLink="true">https://forum.qt.io/post/462150</guid><dc:creator><![CDATA[michaelL]]></dc:creator><pubDate>Wed, 06 Jun 2018 09:01:19 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort Qt5.9.1 issue on Wed, 06 Jun 2018 09:00:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michaell">@<bdi>michaelL</bdi></a> said in <a href="/post/462144">QSerialPort Qt5.9.1 issue</a>:</p>
<blockquote>
<p dir="auto">What i am doing is waiting so that bytes available are equal or greater than 160</p>
</blockquote>
<p dir="auto">Which leads me to the question, <em>how</em> you are doing that.</p>
<p dir="auto">Also, on which platform are you experiencing this behavior?</p>
]]></description><link>https://forum.qt.io/post/462149</link><guid isPermaLink="true">https://forum.qt.io/post/462149</guid><dc:creator><![CDATA[aha_1980]]></dc:creator><pubDate>Wed, 06 Jun 2018 09:00:52 GMT</pubDate></item><item><title><![CDATA[Reply to QSerialPort Qt5.9.1 issue on Wed, 06 Jun 2018 08:59:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/michaell">@<bdi>michaelL</bdi></a> Can you show the code surrounding the code you posted?<br />
Also, who is not receiving what you're writing? You are talking about reading in your code.</p>
]]></description><link>https://forum.qt.io/post/462148</link><guid isPermaLink="true">https://forum.qt.io/post/462148</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Wed, 06 Jun 2018 08:59:31 GMT</pubDate></item></channel></rss>