Cannot use same COM port under external mode for target and host simulink model on Nucleo board

4 vues (au cours des 30 derniers jours)
My error message:
Open failed: Cannot connect to the COM5 port. Possible reasons are another application is connected to the port or the port does not exist.
I have a target model on the nucleo board that uses SCI write to send a sine wave to the host (computer). However, while I'm running (Monitor & Tune) the target model, I then run the host model (simulation pacing) which receives data through COM5 (where my STLink is connected), I get the above error message.
I'm confused since I'm sending data through COM5 on the board as it's where my STLink is connected, shouldn't I be using COM5 to receive as well? Please correct me if my understanding is incorrect.
Attached: host_model is run on my computer, while stmnucleo is run through external mode on the hardware.

Réponses (1)

Brahmadev
Brahmadev le 20 Sep 2023
Hi Vivian,
I understand that you would like to read Serial Data through the COM5 port. The likely cause of the error is that the COM5 port is already in use because of the "Monitor & Tune" option for executing the model on hardware.
Here are a few workarounds:
  1. Deploy the target model using "Build, Deploy & Start" instead of "Monitor & Tune" and then use "Monitor & Tune" on the "Host model".
  2. Execute the Read and Write operations in the same model. For more information, refer to the example: “Send and Receive Serial Data using Arduino Hardware” in the following documentation.
Hope this helps resolve your issue!
Best Regards,
Brahmadev

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by