ATMega Wifi with ESP8266, no response from AT commands

I have a Chinese Mega+WiFi board. It looks the same as the WeMos and the RobotDyn, but there are no identifying markings on it. I have the tx switch set to Tx/Rx 3. I set the first 4 switches to ON since I want to be able to program and run the Mega normally as Serial and to have communication between the ESP8266 and the Mega on Serial3.

I am able to upload a sketch to echo commands (below) into the Mega and it runs. I then try to type "AT+RST" and I don't see anything back. I was powering from my laptop USB port and just saw on the back of the board is says 7-16Volts. So I will try 9V. I have no idea if the ESP8266 comes (as I hope) with the default AT command set in it. And I have no idea how to find out. I don't know if it is my sketch, the switches or no AT firmware in the ESP. Here is the program. Thanks!?

void setup()
{
    Serial.begin(115200);     // communication with the host computer
    //while (!Serial)   { ; }
 
    // Start the software serial for communication with the ESP8266
    
     // Switch the comments on the 2 lines below for an Uno
    //ESPserial.begin(115200);
    Serial3.begin(115200);
 
    Serial.println("");
    Serial.println("Remember to to set Both NL & CR in the serial monitor.");
    Serial.println("Ready");
    Serial.println("");   
}
 
void loop()
{
    // listen for communication from the ESP8266 and then write it to the serial monitor
    // more Uno swapping, change Serial3 for ESPserial
    if ( Serial3.available() )   {  Serial.write( Serial3.read() );  }
 
    // listen for user input and send it to the ESP8266
    if ( Serial.available() )       {  Serial3.write( Serial.read() );  }
}

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

did you set Serial Monitor to send the line endings (Both CR an LF)?

I did set serial monitor to both CR and LF. I leave it that way all the time for my projects. I tried a 9V power supply. Then I tried to switch the switches to USB<> ESP8266. When I open the serial monitor, I see a small string of garbage characters. Entering "AT" and "AT\r\n" does nothing. Every time I open the serial monitor I get more random characters but that is the only time I see anything in the serial monitor. I have tried changing the serial monitor baud rate to all the most popular ones and that gives the same garbage characters. I am setting the switches to ON by pushing them towards the legend table. Towards where I see "on" on the switch.

fdecker:
I did set serial monitor to both CR and LF. I leave it that way all the time for my projects. I tried a 9V power supply. Then I tried to switch the switches to USB<> ESP8266. When I open the serial monitor, I see a small string of garbage characters. Entering "AT" and "AT\r\n" does nothing. Every time I open the serial monitor I get more random characters but that is the only time I see anything in the serial monitor. I have tried changing the serial monitor baud rate to all the most popular ones and that gives the same garbage characters. I am setting the switches to ON by pushing them towards the legend table. Towards where I see "on" on the switch.

the AT firmware is not there. the garbage is the boot log at different baud rate. that is normal.

New Info! I set switch 5&6 again and am connecting using the Aduino Serial monitor. I tried every baud rate. When I select 74,880, I immediately get this:

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
vbc204a9b
~ld

AT Commands still don't work though. So I loaded a blank sketch into the Mega and tried again. Now I get this:

ets Jan 8 2013,rst cause:2, boot mode:(1,6)

fdecker:
New Info! I set switch 5&6 again and am connecting using the Aduino Serial monitor. I tried every baud rate. When I select 74,880, I immediately get this:

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
vbc204a9b
~ld

AT Commands still don't work though. So I loaded a blank sketch into the Mega and tried again. Now I get this:

ets Jan 8 2013,rst cause:2, boot mode:(1,6)

see comment #3

Closed report as not sure what I was looking for.

Back with more info. I am fairly certain the problem was NOT that it did not have firmware, as I have tried 16 different firmware and setting combinations to upload it myself and I still can't get it to work. Current error is:

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

ets_main.c

  1. I went to Expressif site and got their download

  2. Got ESP_8266_NonOs_AT_Bin_v1.74

  3. Tried to follow directions that all reference the same board and all have completely different settings for how to use the expresif firmware update (see links at bottom)

  4. First settings I tried it went into a loop with a light blinking on the board and serial monitor had several lines of error that repeated too quickly to read.

  5. Tried 512-512 and 1024+1024 files no difference in the current error I get no matter what I do. It always stays at baud 78880

The chip on this board says ESP8266EX. One site says to use 80mHz, DIO, 32mBit. The other site says 30mH, QIO 4Mbit, the third site says 80mHz, DIO and 32Mbit-C1 !!!

The expressif readme.md does not match what addresses show if you hover over the files.
Readme

Flash size 8Mbit: 512KB+512KB

boot_v1.2+.bin 0x00000
user1.1024.new.2.bin 0x01000
esp_init_data_default.bin 0xfc000
blank.bin 0x7e000 & 0xfe000

Flash size 16Mbit-C1: 1024KB+1024KB

boot_v1.2+.bin 0x00000
user1.2048.new.5.bin 0x01000
esp_init_data_default.bin 0x1fc000
blank.bin 0xfe000 & 0x1fe000

I have no way to copy the hover help, but it shows
init_data_default 7C000
blank is 7e000 and 3e000

If it shows 3 addresses for "blank" do I stick it in there twice, once for each address? At this point I am just guessing. Can anyone help at least narrow down things to try and help explain what the settings on my chip are? People seem to have gotten this board to work with all sorts of flash sizes!
blank 7e000 &3e000

links:
here https://www.instructables.com/id/Arduino-MEGA-2560-With-WiFi-Built-in-ESP8266/
here https://www.instructables.com/id/ESP8266-Firmware-Upgrade/
and here https://diyodemag.com/projects/fixing_firmware_arduino_bootloader_on_uno_mega_part_1

Tried another combination and got different errors, not sure if I am getting closer or further :wink:

load 0x40100000, len 2592, room 16
tail 0
chksum 0xf3
load 0x3ffe8000, len 764, room 8
tail 4
chksum 0x92
load 0x3ffe82fc, len 676, room 4
tail 0
chksum 0x22
csum 0x22

2nd boot version : 1.7(5d6f877)
SPI Speed : 40MHz
SPI Mode : DIO
SPI Flash Size & Map: 16Mbit(512KB+512KB)
jump to run user1 @ 1000

correct flash map
mismatch map 2,spi_size_map 3
system param partition error
system_partition_table_regist fail
V2
Mo
⸮⸮
⸮Ŵ⸮ų⸮+y⸮%ڍ⸮Fͱ⸮⸮\⸮ݱKA⸮#⸮٫⸮ʭ⸮⸮ɻ⸮ʭ⸮⸮ͫ⸮ҭ⸮ƅQ⸮⸮t
⸮Ųڎ⸮⸮⸮ړ⸮Ͳ*⸮ݵѴ)
A⸮⸮A⸮Ҙ⸮⸮C–aҍѹ⸮ɲ™-녲⸮ᐷ⸮ʘ!*⸮#⸮i=⸮{

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

make no changes in parameters

Thank you for all your help. IT IS WORKING!! That looks like a python script. I am using the Expressif download tool. Could you answer one more question? Which of the settings just have to match the ESP for uploading and which things load a setting that the chip will use in its firmware? IOW, what do all the settings do :wink: In the "picture is worth a thousand words" department, here is the settings that worked. I notice you use the 1024+1024 file and I used the 512+512. How do I know what files will work and what won't? I looked everywhere for the specs of this board and the ESP8266EX and can't find how much memory it has or what settings match it. One big mistake I made in the beginning was not checking the default speed in mHz. Note file files, that it is the 2.2 SDK version, and the settings in the firmware uploader. Also there is an init 05 file and an init 05. Not sure if it made a difference since I was trying different files, but I chose the 08 this time.

the Flash Download Tool changes the uploaded binary before upload. it applies the settings.
esptool.py doesn't change anything in the binary. the standard '1024' binaries are built for esp with 2 MB flash.

the readme or the AT reference have all the information about addresses and binaries used.

I recommend my WiFiEspAT library to use the AT firmware from ATmega2560. GitHub - JAndrassy/WiFiEspAT: Arduino networking library. Standard Arduino WiFi networking API over ESP8266 or ESP32 AT commands.

fdecker:
Thank you for all your help. IT IS WORKING!! That looks like a python script. I am using the Expressif download tool. Could you answer one more question? Which of the settings just have to match the ESP for uploading and which things load a setting that the chip will use in its firmware? IOW, what do all the settings do :wink: In the "picture is worth a thousand words" department, here is the settings that worked. I notice you use the 1024+1024 file and I used the 512+512. How do I know what files will work and what won't? I looked everywhere for the specs of this board and the ESP8266EX and can't find how much memory it has or what settings match it. One big mistake I made in the beginning was not checking the default speed in mHz. Note file files, that it is the 2.2 SDK version, and the settings in the firmware uploader. Also there is an init 05 file and an init 05. Not sure if it made a difference since I was trying different files, but I chose the 08 this time.

Hi,

I am stuck too with this same issue, Can you please give me step by step process how to do it, I am fairly new to this :slight_smile:

Hi,

Thanks to Juraj and fdecker for the help, only difference I did was I used esptool.exe, if you dont want to install python then esptool.exe is a good utility.

I added the port and baudrate to the juraj command after copying the firmware file to esptool.exe folder along, the files to be copied are

blank.bin
boot_v1.7.bin
esp_init_data_default_v08.bin
and at folder
all this from NonOS firmware folder

run CMD in administrator privileges to access port

this is the command I used

esptool.exe --port COM5 --baud 115200 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

Just a note PIN 5,6,7 on rest off. I pressed RESET and MODE, while MODE pressed i released RESET and kept MODE pressed. after I pressed enter in CMD window to execute above command I released MODE button

I used RealTerm Serial Capture Program to check AT command are working.

Thanks a lot for Arduino forum, now on to next step :slight_smile: