Incoming USB characters lost

I have an Arduino Pico connected to MATLAB and I use Terminated (CR/LF) trigger to read the input. Each message is about 10 to 12 characters and they come in at random intervals of a few seconds but potentially as fast as a few ms apart. It works 99% of the time or so but I am losing some character packets. It appears that if I am also writing data to disk that USB packets get dropped more often. Is there a way to make sure data isn't lost?

3 comentarios

Rik
Rik el 3 de Mayo de 2025
You might have to share more details about your setup and your code.
Also, does there seem to be a relation between the interval and the chance of data loss?
Andrei
Andrei el 28 de Mayo de 2025
Gavin, please contact MathWorks Support to investigate the issue.
Gavin
Gavin el 4 de Nov. de 2025
Although every line sent ends with CR/LF terminator. Later invertigation has shown that the string arrived and is sitting in the Serial port's input buffer. I did a work around where the Arduino Pico sends an extra CR/LF if it doesn't hear from ML in a while (a few seconds) indicating that it's hung up. So far that's working.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB Support Package for Arduino Hardware en Centro de ayuda y File Exchange.

Productos

Versión

R2024b

Etiquetas

Preguntada:

el 1 de Mayo de 2025

Comentada:

el 4 de Nov. de 2025

Community Treasure Hunt

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

Start Hunting!

Translated by