serial port communication missing characters
7 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Dinesh
on 27 Sep 2023
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.
0 Comments
See Also
Categories
Find more on Get Started with Embedded Coder Support Package for STMicroelectronics STM32 Processors in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!