Build error in Simulink using TCP/IP Send block

I've made a simple project using Instrument Control Toolbox but every time I try to build my project to my Arduino Nano 33 IoT in external mode, I got the following error:
  • In order to generate code from AsyncIO, the target hardware must be MATLAB Host or a compatible device. The error occurred for MATLAB System block 'Arduino_wifi/TCP//IP Send'.
I configured my hardware inside model settings to connect to my local WiFi and changed the External mode to 'XCP on WiFi'.

 Réponse acceptée

Arun Kumar
Arun Kumar le 4 Oct 2022

0 votes

Hi Alex,
Please use the following block for TCP/IP communication on arduino board:
Hope this helps!

9 commentaires

Hey Arun,
I also tried this block but for some reason, it is not sending any data through the port. I made a client using the 'WiFi TCP/IP Receive' block and another using Python but neither receives any data.
Any idea?
Thanks in advance!
Hi Alex,
can you share your model?
Which mode of deployment are you trying to run: "Monitor & Tune" or "Build, Deploy & Start"
I just try to connect a uint8 constant to the ‘WiFi TCP/IP Receive’ block and “Build, Deploy & Start”. In the model settings I changed my Nano 33 IoT’s external mode to ‘XCP on Wifi’ and set my local wifi credentials. The communication port is open and I use static IP.
  1. Since you are using the deployment mode, external mode settings will not be used. So you can ignore the 'XCP on wifi' setting
  2. When you deploy the model, do you see any IP address assinged to Arduino board? IP address will be displayed in the diagnostic viewer when you deploy the code to Arduino.
Yeah, I see the IP 192.168.8.120 and this is what I used in my Python script. There’s connection but no data transfer. Also tested with Arduino’s Receive block and Instrument Control Toolbox Receive block aswell.
Arun Kumar
Arun Kumar le 4 Oct 2022
Modifié(e) : Arun Kumar le 4 Oct 2022
Hi Alex, could you try sending some bytes from python client and check if the communication starts?
I have seen issues with the wifi nina library(which is used by Nano 33 IoT) where the library would fail to send data until it receives some bytes.
Hey,
Thanks for your answer!
Yeah, this was the issue. However, the Arduino's 'WiFi TCP/IP Receive' block still not working but the Instrument Control Toolbox block is working now. Thank you so much!
Hi Alex,
The Arduino library's WiFi TCP/IP blocks are meant for deployment on Arduino boards and not for running simulation on the host machine.
You can use this block to receive data from TCP/IP on Arduino.
Hi Arun,
That's understandable. Thank you very much for your help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Produits

Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by