Go Down

Topic: ATMega Wifi with ESP8266, no response from AT commands (Read 370 times) previous topic - next topic

fdecker

Jun 29, 2020, 11:45 pm Last Edit: Jun 30, 2020, 09:05 am by Coding Badly
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!?

Code: [Select]

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: [code] [/code] tags added.

Juraj

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

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.

Juraj

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.

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)


Juraj

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

ballscrewbob

Closed report as not sure what I was looking for.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google (who would have thunk it ! ) or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

fdecker

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


fdecker

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

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–ҍѹ⸮ɲ™-녲⸮ᐷ⸮ʘ!*⸮#⸮i=⸮{

Juraj

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

fdecker

#10
Jul 04, 2020, 02:41 am Last Edit: Jul 04, 2020, 02:47 am by fdecker Reason: added clarification about the init file
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 ;) 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.


Juraj

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.
https://github.com/espressif/esptool

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. https://github.com/jandrassy/WiFiEspAT

Go Up