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

 採用された回答

Arun Kumar
Arun Kumar 2022 年 10 月 4 日

0 投票

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

9 件のコメント

Alex Papdi
Alex Papdi 2022 年 10 月 4 日
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 2022 年 10 月 4 日
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 2022 年 10 月 4 日
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 2022 年 10 月 4 日
  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 2022 年 10 月 4 日
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 2022 年 10 月 4 日
編集済み: Arun Kumar 2022 年 10 月 4 日
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 2022 年 10 月 5 日
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 2022 年 10 月 6 日
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 2022 年 10 月 7 日
Hi Arun,
That's understandable. Thank you very much for your help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

製品

リリース

R2022b

質問済み:

2022 年 10 月 1 日

コメント済み:

2022 年 10 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by