- For issues related to Arduino connection failures: https://www.mathworks.com/help/matlab/supportpkg/arduino-connection-failure.html
- For problems with lost connections and data transfer: https://www.mathworks.com/help/matlab/supportpkg/connection-and-communication-issues.html
Connection via TCP/IP with Arduino nano 33iot and Simulink
14 views (last 30 days)
Show older comments
Hello everyone, I am doing a project that aims to create wireless communication between the Arduino nano 33 iot and the Simulink program. To do this, I have made use of the TCP/IP blocks offered by simulink. I have made two programs in Simulink, one is the one that I have loaded on the Arduino and another is to control with Dashboard elements. The arduino connects to the WIFI connection, but the data that I send from the control program is not transferred. I have tried everything, checking my laptop's firewall in case it had any restrictions, updating the drivers and checking if the network speed is adequate. Could it be that two simulink programs cannot be run at the same time? Also when making the connection I get this error and I don't know why it is:
An error occurred while running the simulation and the simulation was terminated
Caused by:
MATLAB System block 'setup_Wifi_conTCP_Simulink/TCP//IP Receive' error occurred when invoking 'stepImpl' method of 'instrument.system.TCPIPReceive'. The error was thrown from '
'C:\Program Files\MATLAB\R2022b\toolbox\instrument\instrumentblks\+instrument\+system\TCPIPReceive.m' at line 388'.
Error receiving data from the remote server.
Additional Information: Operation timed out before requested data was received.
Component:Simulink | Category:Block error
0 Comments
Answers (2)
Deep
on 20 Dec 2024
Edited: Deep
on 20 Dec 2024
The error you experienced suggests that the already running simulation disconnects from the Arduino when you attempt to establish a different connection. In my experience, the server uploaded to the Arduino during the setup process can only handle one Wi-Fi connection from MATLAB at a time, as I have encountered issues when trying to create multiple connections.
I suggest merging your logic into a single model. This should help prevent potential conflicts by ensuring that only a single connection to the Arduino is used.
If you still experience data transfer problems, you might find these troubleshooting resources helpful:
0 Comments
Angela
on 20 Dec 2024
1 Comment
Deep
on 24 Dec 2024
It would be helpful if you could share the models so I can review how they might be merged. In the meantime, here is another workaround you can try. Please note that I cannot verify this on my end as I do not currently have access to an Arduino.
Try running the program to be loaded on the Arduino in "External mode," followed by running your controller program in "Connected IO mode." My understanding is that "Connected IO mode" does not require the currently simulating model to be the same one deployed on the Arduino, since code generation is not involved (see: https://www.mathworks.com/help/simulink/supportpkg/arduino_ug/connected-io.html).
See Also
Categories
Find more on Modeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!