フィルターのクリア

serial port communication missing characters

2 ビュー (過去 30 日間)
Matthias Imboden
Matthias Imboden 2023 年 5 月 24 日
回答済み: Dinesh 2023 年 9 月 27 日
I am attempting to read and write using serial commands to an STm32 nucleo.
In putty it works well.
When using Matlab it appears I am missing characters when sengind a command.
I am debugging using the Test&Measuremetn Tool, I get the same results when scripting using writeline() and readline().
For example in the Test&Measuremetn Tool
if I write "help" I get the correct response with the read button: First time I click on 'read' it returns "sh>help" and if I click again on 'read' I get "data168 (Commands:helpgetadcl...)", which is coorect.
However if I write "level 1 2000 1000" and then click on 'read' the retunerd value is "sh> level 1 200 1000".
Typically the 13th digit is missing, but this is not consistent.
As said, it works in putty. The short write commands seem to work in Matlab, but not the longer one.

回答 (1 件)

Dinesh
Dinesh 2023 年 9 月 27 日
Hi Mathias,
I understand that you are experiencing issues related to missing characters when receiving longer commands and it is random. One possible reason for this issue could be a high baud rate. The maximum baud rate for the STm32 nucleo is 115200. I suggest trying a lower baud rate to facilitate smoother communication.
Additionally, for baud rates greater than 9600, please ensure that you set the 'flow control' property of the 'serialport' object to 'hardware' mode. This will help optimize the communication process.
For more detailed information about the serial port object and its properties, please refer to the following MATLAB documentation.
Hope this helps.
Best Regards,
Dinesh Reddy Gatla.

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by