simulink; Failed to connect to Arduino board, when using esp8266

34 vues (au cours des 30 derniers jours)
Thale
Thale le 4 Juil 2023
Hi!
I just bought a esp8266 (https://www.reichelt.com/at/en/developer-boards-esp8266-wi-fi-module-debo-esp8266-p192142.html?&trstct=pos_0&nbc=1), to connect to my arduino Uno (Type elegoo Uno rev3).
I have connected the esp to my arduino uno, as documented in the datasheet for the esp. Then, I tried to use the simulink example code arduinomega2560_wifitcpsend, described in https://se.mathworks.com/help/supportpkg/arduino/ref/getting-started-with-wifi-on-arduino-hardware.html. I also changed the hardware, and from shield to esp8266, so this should not be a problem. When I tried to upload this to the arduino the first time, I got as an error that "Failed to assign IP address to ESP8266.", I then followed this matlab guide to try to fix the problem (exept the point of updating the firmware, I could not figure out how to do this) https://se.mathworks.com/help/supportpkg/arduino/ref/getting-started-with-wifi-on-arduino-hardware.html. I this example I had connected RX to RX and TX to TX though. So this was probably the problem? I have also tried the same example with another esp8266 (with the development board), but got the same problem.
But when having connected RX (pin 0 on arduino) to TX on the esp, and TX (pin 1) to RX of esp, I got the new error;
The following error occurred during deployment to your hardware board: Failed to connect to Arduino board. Verify connection and the host COM port number entered in 'Configuration Parameters > Target hardware resources > Host-board connection' and try again. To find out the COM port number in Windows, open Device Manager and open your board in the COM ports group.
I also just tried a small LED-circuit, where I sent a pulse from the arduino til pin 9, that then turned the LED on every second. When I run it, without the arduino being connected to the esp8266, this works. If the arduino and esp8266 are connected, on the other hand, I get the same error about not bein able to connect to the arduino board (and this is without having e.g. wifi-blocks in the led simulink code. It is only a pulse generator and a arduino pin-9 output)
I have also tried connecting both of the esp's through the arduino ide, but get similar problems about the system not bein able to find them/the com.
Could anyone help me? I am really lost, and have been trying to figure this out for a week. (edit; And I should use this in a project at school, that should be delivered in 8 days ahha, so I am a bit desperate <3) Thank you for reading!
  1 commentaire
Thale
Thale le 4 Juil 2023
Modifié(e) : Thale le 4 Juil 2023
I have now tested, with having RX at TX, TX at RX. And then taken out CH_PD once, then I get the "Failed to assign IP address to ESP8266.", error. I tried again, using all the connections as in the documentation, but taking out the GPIO0 connection. This time I also got "Failed to assign IP address to ESP8266.".
When I have all connections the same as in the documentation, I get the COM error. Could it be that the COM changes, when the arduino is connected to the external wifi module?
Also, when I did the arduino IDE example in the esp6288 documentation I got a connection error;
connecting........_____....._____....._____....._____....._____....._____.....____Traceback (most recent call last):
and then:
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

Connectez-vous pour commenter.

Réponses (1)

Nathan Hardenberg
Nathan Hardenberg le 11 Juil 2023
A friend of mine had a similar problem. The problem is probably that you use the only serial interface (UART) of the Arduino UNO for the connection to you PC/Simulink automatically. Now you also want to use it to connect to th ESP. That does not work.
If you want to use UART/Serial with Simulink and also want to use it as other communication you most likely have to use the Arduino Mega, since it has more serial connections
Maybe you can just "build and run" the model and not "run & Tune", but I don't know if this works, since you also use the serial interface to write to the arduino

Catégories

En savoir plus sur Arduino Hardware dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by