Hi, ? am ne in Qt. I was trying to send data from STM32f407vg to Qt. The data is produced by RTC module and gives time, date (for example, 2024-03-11T17:01:24+08:00Monday). However the data read by Qt is not full in text edit always. It is like a loop below and repeated always.
```
2
2
2
20
20
20
202
202
202
2024
2024
2024
2024-
2024-
2024-
2024-0
2024-0
2024-0
2024-03
2024-03
2024-03
2024-03-
2024-03-
2024-03-
2024-03-1
2024-03-1
2024-03-1
2024-03-11
2024-03-11
2024-03-11
2024-03-11T
2024-03-11T
2024-03-11T
2024-03-11T1
2024-03-11T1
2024-03-11T1
2024-03-11T17
2024-03-11T17
2024-03-11T17
2024-03-11T17:
2024-03-11T17:
2024-03-11T17:
2024-03-11T17:0
2024-03-11T17:0
2024-03-11T17:0
2024-03-11T17:01
2024-03-11T17:01
2024-03-11T17:01
2024-03-11T17:01:
2024-03-11T17:01:
2024-03-11T17:01:
2024-03-11T17:01:1
2024-03-11T17:01:1
2024-03-11T17:01:1
2024-03-11T17:01:17
2024-03-11T17:01:17
2024-03-11T17:01:17
2024-03-11T17:01:17+
2024-03-11T17:01:17+
2024-03-11T17:01:17+
2024-03-11T17:01:17+0
2024-03-11T17:01:17+0
2024-03-11T17:01:17+0
2024-03-11T17:01:17+08
2024-03-11T17:01:17+08
2024-03-11T17:01:17+08
2024-03-11T17:01:17+08:
2024-03-11T17:01:17+08:
2024-03-11T17:01:17+08:
2024-03-11T17:01:17+08:0
2024-03-11T17:01:17+08:0
2024-03-11T17:01:17+08:0
2024-03-11T17:01:17+08:00
2024-03-11T17:01:17+08:00
2024-03-11T17:01:17+08:00
2024-03-11T17:01:17+08:00M
2024-03-11T17:01:17+08:00M
2024-03-11T17:01:17+08:00M
2024-03-11T17:01:17+08:00Mo
2024-03-11T17:01:17+08:00Mo
2024-03-11T17:01:17+08:00Mo
2024-03-11T17:01:17+08:00Mon
2024-03-11T17:01:17+08:00Mon
2024-03-11T17:01:17+08:00Mon
2024-03-11T17:01:17+08:00Mond
2024-03-11T17:01:17+08:00Mond
2024-03-11T17:01:17+08:00Mond
2024-03-11T17:01:17+08:00Monda
2024-03-11T17:01:17+08:00Monda
2024-03-11T17:01:17+08:00Monda
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
2024-03-11T17:01:17+08:00Monday
When ? tested in termit terminal, the data is read properly like
2024-03-11T17:01:17+08:00Monday
The data is transmitted in stm32
sprintf(buffer, "%04d-%02d-%02dT%02d:%02d:%02d%+03d:%02d%s\n",
year, month, date, hour, minute, second, zone_hr, zone_min, DAYS_OF_WEEK[dow]);
HAL_UART_Transmit(&huart3, buffer, strlen(buffer), 1000);
sprintf(buffer, "%04d-%02d-%02dT%02d:%02d:%02d%+03d:%02d%s\n",
year, month, date, hour, minute, second, zone_hr, zone_min, DAYS_OF_WEEK[dow]);
HAL_UART_Transmit(&huart3, buffer, strlen(buffer), 1000);
To copy to clipboard, switch view to plain text mode
The data is read by qt code
if(bufferSplit.length() < 3)
{
serialData = serialPort.readAll();
serialBuffer
+= QString::fromStdString(serialData.
toStdString());
}
else //bufferSplit[0] is a good value
{
qDebug() << bufferSplit;
serialBuffer = "";
}
ui->display_line->append(bufferSplit[0]);
}
QStringList bufferSplit = serialBuffer.split("\n");
if(bufferSplit.length() < 3)
{
serialData = serialPort.readAll();
serialBuffer += QString::fromStdString(serialData.toStdString());
}
else //bufferSplit[0] is a good value
{
qDebug() << bufferSplit;
serialBuffer = "";
}
ui->display_line->append(bufferSplit[0]);
}
To copy to clipboard, switch view to plain text mode
The data is splitted (according to \n) and stored in the buffer to be read.
The bufferlist is below and ? have taken 0. index
QList("2024-03-11T17:01:24+08:00Monday", "2024-03-11T17:01:25+08:00Monday", "")
Bookmarks