Arduino Mega with Wifi, no response from Wifi

Hi. I've boought an aftermarket Mega 2560 with on board Wifi ESP 8266.
I've set the dip switches to CH340 -> 2560 -> ESP8266 (ON ON ON ON OFF OFF OFF OFF) and the single switch to TXD3. Google says that the ESP8266 should now respond to Arduino on Serial3. I've initiated Serial3 and sent an AT command but there is no response from the 8266.

Is there something I may have missed?

I tested my code on Wokwi using a Mega, and external ESP8266 and the same code works fine. I've just changed from software serial to hardware Serial3 on the Mega with Wifi board.

try the CheckFirmware example of my WiFiEspAT library. the library is in Library Manager.
change Serial1 to Serial3 in the sketch

Hi. I uploaded the CheckFirmware example of the WiFiEspAT library, changing Serial1 to Serial3. There is no response at all, not even "Error getting AT firmware version". I added Serial.println("Starting sketch..."); to the start of the code to check the sketch is working and it is.

Dip switches are ON ON ON ON OFF OFF OFF OFF and RXD3/TXD3.

The seller just sent me another board. But the same happens on the second board.

I connected to the ESP8266 directly using a Serial utility (Dip switches OFF OFF OFF OFF ON ON OFF OFF). With the Baud rate set to 115200 I see the ESP8266 returning gibberish. With Baus set to 9600 the ESP8266 returns a slow and continuous string of dots.

flash the AT firmware to the esp8266

https://github.com/espressif/ESP8266_NONOS_SDK/releases

https://github.com/espressif/esptool#installation--dependencies

esptool.py write_flash --flash_size 2MB-c1 0x0 boot_v1.7.bin 0x01000 at/1024+1024/user1.2048.new.5.bin 0x1fb000 blank.bin 0x1fc000 esp_init_data_default_v08.bin 0xfe000 blank.bin 0x1fe000 blank.bin

Thanks, I can't see the COM port in that command, so I added it. I get an error though:

remove the port argument or give it a correct value like COM5

Thank you. The flash appears to have been successful. Next I'll check if the chip responds to AT commands.

C:\Users\Philip\Downloads\ESP8266_NONOS_SDK-3.0.5\ESP8266_NONOS_SDK-3.0.5\bin>esptool.py write_flash --flash_size 2MB-c1 0x0 boot_v1.7.bin 0x01000 at/1024+1024/user1.2048.new.5.bin 0x1fb000 blank.bin 0x1fc000 esp_init_data_default_v08.bin 0xfe000 blank.bin 0x1fe000 blank.bin
esptool.py v4.3
Found 3 serial ports
Serial port COM6
Connecting...
COM6 failed to connect: Write timeout
Serial port COM5
Connecting....
Detecting chip type... Unsupported detection protocol, switching and trying again...
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 40:f5:20:28:93:03
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00000fff...
Flash will be erased from 0x00001000 to 0x00065fff...
Flash will be erased from 0x001fb000 to 0x001fbfff...
Flash will be erased from 0x001fc000 to 0x001fcfff...
Flash will be erased from 0x000fe000 to 0x000fefff...
Flash will be erased from 0x001fe000 to 0x001fefff...
Flash params set to 0x0050
Compressed 4080 bytes to 2936...
Wrote 4080 bytes (2936 compressed) at 0x00000000 in 0.3 seconds (effective 96.9 kbit/s)...
Hash of data verified.
Compressed 413556 bytes to 296987...
Wrote 413556 bytes (296987 compressed) at 0x00001000 in 26.2 seconds (effective 126.3 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x001fb000 in 0.1 seconds (effective 437.1 kbit/s)...
Hash of data verified.
Compressed 128 bytes to 75...
Wrote 128 bytes (75 compressed) at 0x001fc000 in 0.1 seconds (effective 13.1 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x000fe000 in 0.1 seconds (effective 409.8 kbit/s)...
Hash of data verified.
Compressed 4096 bytes to 26...
Wrote 4096 bytes (26 compressed) at 0x001fe000 in 0.1 seconds (effective 420.3 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

C:\Users\Philip\Downloads\ESP8266_NONOS_SDK-3.0.5\ESP8266_NONOS_SDK-3.0.5\bin>
[/quote]

Hi Juraj, thank you, flashing the firmware seems to have worked. When I run the Check Firmware example the firmware version is displayed in the serial monitor.

I get a strange response to my vanilla code AT commands. Eg if my arduino sketch sends Serial3.print("AT+RST\r\n"); then I get the following response. But I guess this is another topic, I'll play around this evening and try to solve this.

A?I5Q
?HO?H

it is normal to get garbage in Serial Monitor after reset of esp8266. it is the esp8266 boot log at a different baud rate

Good to know thanks. I've managed to connect to a wifi network, but struggling to connect to a host. I read in one of your old posts that AT commands and responses can vary, hence the need for WiFiESP. I want to send data to a TCP API, so will need to upgrade the firmware again to v2.

don't use AT 2 on ESP8266. the AT 1.7.5 is excellent and you can use it with the WiFiEspAT library.

Do I need Jiri Bilek's 1.7 firmware to send data from my Arduino to a TCP API?

you flashed the standard AT firmware so you can now write your sketch with WiFiEspAT and you can ask here if it doesn't work.

(Jiri Bilek's firmware is need to communicate with servers with TLS 1.2 secure protocol. has your server TLS 1.2?)

Yes TLS 1.2. I want my Arduino to send logs to Amazon Cloudwatch via API Gateway, which uses TLS 1.2. I'll install JB's firmware tonight.

Jiri's firmware is excellent. UDP is not implemented yet but I guess you don't need UDP.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.