I am trying to program an ESP8266 12E (or possibly 12F) with my Arduino Mega 2560 with "ESP8266_LED_Control" Sketch found widely on the internet. I believe I have all the settings correct, but keep getting the following errors:
Arduino TX LED flashes as does the ESP LED. For about 8 times, then upload fails.
I believe I have correctly set the ESP into programming mode and all connections are correct.
How do you have the Mega connected to the ESP8266? Typically when someone connects a standard Arduino board to an ESP8266 they are running the sketch on the Arduino and only using the ESP8266 for WiFi communication controlled over serial with the AT firmware. You are trying to program the ESP8266 directly. Are you only using the Mega as a USB to serial adapter? I'm sure that could be done but I've never heard of it. Please post a link to the instructions you're following.
mrarduinoman:
"ESP8266_LED_Control" Sketch found widely on the internet.
Please post a link to it. We shouldn't have to go hunting all over the internet and try to figure out if it's the same sketch just to try to help you.
Step 7 talks about how to set up the Arduino as a serial programmer.
I have the proper RX/TX and ground connections. I'm powering the ESP from a separate power supply. I ground GPIO0 and power up the ESP (Since I don't have a reset button).
-The only thing in this step I am unclear about is the SoftwareSerial include file. I don't really know what that is, or where to get it.
I have Arduino IDE settings as described in the next few steps.
I have to believe the factory sketch is not on the ESP, since it already has the Chinese program on it for light control. And it does not respond to AT commands.
Step 16 has the LED_Control sketch that I'm using. Modified for my own SSID/PW.
Step 17... the blue LED on the ESP flashes about once per second for 6-8 times (as does the TX on the Arduino). But then the error messages and failed flash.
UPDATE:
With serial monitor running, when I power up the ESP in programming mode I get a bunch of garbage text... I assume it is the initialization.
In Run Mode I get after the garbage text:
add if0
dhcp server start:(ip:192.168.4.1,mask:255.255.255.0,gw:192.168.4.1)
add if1
bcn 100
S > create socket: 0
S > bind port: 80
S > listen ok
S > wait client
So it seems the Arduino is communicating with the ESP.
Also realized what the SoftwareSerial include library is and put that in the sketch.
mrarduinoman:
when I power up the ESP in programming mode I get a bunch of garbage text... I assume it is the initialization.
That's a very frustrating thing to me. Apparently the bootloader runs at 74880 baud(which is the cause of that garbage text) but then there's other output after a crash at 115200 so I get gibberish either way I set the baud rate. Maybe there's a way to change it that I haven't found yet. You might have a look with the serial monitor at 74880 just to see what the bootloader is saying.
I have no real experience with the arduino. Is there a way to program the sketch to start uploading at 74880 then switch to 115200? Essentially overriding the setting in the menu?
There's a Tools > Upload Speed menu but I have mine set to 921600 so that doesn't seem to have anything to do with the 74880 baud of the bootloader output.
mradruinboman:
I have no real experience with the arduino. Is there a way to program the sketch to start uploading at 74880 then switch to 115200? Essentially overriding the setting in the menu?
Have you tried upload NodeMCU firmware to that esp8266?
If not, should try. After uploading successfully, your esp8266 will be set to 115200 as default and you can upload your new Arduino sketch following the tutorial which you are referring.