Borrar filtros
Borrar filtros

How to handle fopen error preventing the script to stop?

1 visualización (últimos 30 días)
Andrea Bettati
Andrea Bettati el 4 de Mayo de 2019
Hi to you all,
I'm using matlab to communicate with a microcontroller and send data over UART.
To initialize the serial communication I use fopen. The problem is that oftet I plug and unpload the board from my computer and the port changes.
under Linux I see either ttyACM1 or ttyACM2.
When Matlab does not ind the port i got this
Error using serial/fopen (line 72)
Open failed: Port: /dev/ttyACM1 is not available. Available ports: /dev/ttyACM0, /dev/ttyS4.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.
Error in initialize_NXP (line 14)
fopen(serial_object);
And the script stops. Is there a way to handle this and call fopen on ttyACM2?
BR,
Andrea

Respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by