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'.

 Respuesta aceptada

Arun Kumar
Arun Kumar el 4 de Oct. de 2022

0 votos

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

9 comentarios

Alex Papdi
Alex Papdi el 4 de Oct. de 2022
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!
Arun Kumar
Arun Kumar el 4 de Oct. de 2022
Hi Alex,
can you share your model?
Which mode of deployment are you trying to run: "Monitor & Tune" or "Build, Deploy & Start"
Alex Papdi
Alex Papdi el 4 de Oct. de 2022
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.
Arun Kumar
Arun Kumar el 4 de Oct. de 2022
  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.
Alex Papdi
Alex Papdi el 4 de Oct. de 2022
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 el 4 de Oct. de 2022
Editada: Arun Kumar el 4 de Oct. de 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.
Alex Papdi
Alex Papdi el 5 de Oct. de 2022
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!
Arun Kumar
Arun Kumar el 6 de Oct. de 2022
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.
Alex Papdi
Alex Papdi el 7 de Oct. de 2022
Hi Arun,
That's understandable. Thank you very much for your help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2022b

Preguntada:

el 1 de Oct. de 2022

Comentada:

el 7 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by