ESP8266 update firmware to change the baudrate
So today I figured I could update firmware on my ESP8266 to make it useful for work with the arduino uno. The problem with the original firmware is that the serial port baudrate is fixed at 115200 which is way too fast for the softserial library and even too fast for uno’s normal serial port to be reliable. The new firmware supposedly features adjustable baudrate and also a few bug fixes.
First you need to prepare yourself for the firmware upgrade. Download the firmware update tool and the latest firmware binary. (The links may get updated sometimes so if they don’t work check here >>) Both files can be found on this page. Next you need to connect your wifi module via serial to USB converter to computer (I use CP2102) and provide it with some quality power supply (I use breadboard 3V/5V power regulator with external wall-wart). If the flashing goes wrong your device may be rendered useless so you should be careful 😉 (You may also use arduino as both the power source and USB-serial converter, I have used it in my previous posts as a power source. Actually the flashing process should take less power than connecting to WIFI so you may be safe here; I however have not tested it.)
The connection for the flashing is slightly different than the normal connection. In addition to the normal connections you also have to pull down (connect to GND) the GPIO0 pin.
Connections to be made:
CP2102 TX – ESP8266 RX
CP2102 RX – ESP8266 TX
CP2102 GND – PSU GND
PSU 3V – ESP8266 VCC
PSU 3V – ESP8266 CH_PD
PSU GND – ESP8266 GND
PSU GND – ESP8266 GPIO0 (should be connected for flashing operation)
I suggest you to connect everything before powering up to prevent damage to the module. My power regulator also has a power switch which elegantly lets you power on / power off (reset) the module without removing any wires. You can switch between normal work mode and flash mode by removing/connecting GND-GPIO0 connection and power cycling the module.
Before actually updating the firmware I checked the current firmware version on the module. Connect with a terminal emulator software of your choice to the serial port that connects to ESP8266 (I use RealTerm). Power off the module, disconnect the GPIO0 pin and power it on. You should get some gibberish and then a “ready” word (you may get other strings depending on firmware). If you only get gibberish you may have the baudrate set wrong, the GPIO0 still connected to GND or some wierd firmware.
When you got the “ready” message you can read the current version by sending “AT+GMR” command to the module. The command should be terminated with newline. You can see my older posts on various other AT commands available.
The printed version denominates the currently installed firmware version. If you like what you see you may not even need to update it 🙂
Next I tried what the module sends to the serial port when GPIO0 pin is held to GND. I powered off the module, reconnected GPIO0-GND connection and powered it up again. There was nothing human-readable at any baudrates I tested, just some random characters like this:
So the next step is to close the terminal emulator software (if you don’t close the port the updater software won’t be able to connect to it) and fire up the XTCOM firmware update tool.
(For easier reading this is a multipage post, please choose page below.)
Updated using the latest on electrodragon (9.2.2) and if connected at 9600, but AT commands didn’t work initially- it needs cr/lf, previous version didn’t. Was using Putty, which can’t do cr/lf, so switched to another one. All OK now- was able to connect to an android hotspot and send some text between a socket test app (called SP).
Great you got it working 🙂
Putty can do cr/lf, but you need to press two keys, first Enter (Ctrl + M = Return = CR) and then Ctrl + J (LF). You also have to change some settings to receive CR+LF as a single newline. Overall putty is a great tool for ANSI emulation (say like connecting via SSH or serial to server), but it falls short for direct serial communication with low level devices where there is an occasional need to send some special characters or where you want to predefine some strings to send. You may want to try out RealTerm or Bray Terminal 🙂
Just another thing. When flashing new firmwares over the old ones you may have to reset/powercycle the module several times before it starts working. For some firmwares it is also better to first load an empty bin file blank.bin to a specifed address before the module will boot up correctly. This is because also settings are saved in flash and if the settings format don’t match the installed firmware the module won’t be happy about it.
hi i want to simply change the baudrate of ESP8266 wifi module i have downloaded the files XTCOm and bin files,
but how do i proceed?
what are the files i should flash into the ESP 8266 module?
Hi, have you checked the whole procedure (this post is multipage)? You should unpack the zip archive and there is a bin file inside it that should be flashed to the module. I also noticed that the direct link does not work anymore – i fixed it but it may become borken in future – if so you have to go to the electrodragon site to get the file.
Just curious, why you don’t connect ESP8266 directly into CP2102’s RX/TX/GND/+3V? (in other words: remove the power from breadbaord)
CP2102 doesnt have enough power/output current capability to supply the ESP8266 module. If connecting directly you can expect random errors while operating or ESP8266 and/or CP2102 reseting. This will probably be true for most USB2TTL converters as the internal regulator is usually meant to regulate the power for the chip itself, not power-hungry external components 😛 Even if supplying power from Arduino which has a purpose-chip power supply you have to add additional capacitors for stable operation.
Very happy with this post. I finally got my esp8266 working with my Arduino. Templogger was working the next dat and many more stuff van follow now.
Hi, what could it be if I succeed on the config device window, but when trying to flash the memory using the files in https://github.com/espressif/ESP8266_AT/tree/master/bin
I get an error code 5?
You should be more specific in your error description. Are you using the same tools as in my post or are you using another flashing tool? Do you get error in the flash tool or when trying to boot the flashed board? My understanding is that to make it work you need to flash each of the bin files to their corresponding location (I haven’t tried it). Nodemcu flasher seems even a bit user friendlier to flash the firmwares 🙂 Note that incorrect flash size on the board or faulty flash may also cause problems. Same with bad power supplies…