I recently bought an ESP-01 as well as an FTDI programmer (3.3v-5v) and after typing AT+GMR
I noticed it said:
- AT version:0.40.0.0(Aug 8 2015 14:45:58)
- SDK version:1.3.0
- Ai-Thinker Technology Co.,Ltd.
- Build:1.3.0.2 Sep 11 2015 11:48:04
I have looked and looked on a way to upgrade its firmware (on MacOS) to no avail. How can I upgrade it? I want to be able to change the baud rate to 9600. A lot of examples to do it are in windows requiring another application or something like that but how can I do it in a Macbook? Thanks.
3 Answers 3
Here is the step-by-step on upgrade the ESP-01 AT Command firmware (for running on macOS).
Wiring
For flashing the ESP-01 firmware, you need to have a USB-TTL adaptor as a programmer.
+---------------------+---------+
| | RxD Vcc |
| Top View | IO2 RST |
| | IO0 CPD |
| | GND TxD |
+---------------------+---------+
ESP-01 USB-TTL Adaptor
VCC ---------- 3V3
GND ---------- GND
TxD ---------- RxD
RxD ---------- TxD
CH_PD ---------- see note* below
GPIO0 ---------- Connect to a push switch (Flash button) to GND
RST ---------- a push switch (Reset button) to GND
Note: depend on whether you have ESP-01 or ESP-01S, for ESP-01, you will need to connect CH_PD either directly to 3v3 or via a 3k-10k resistor to 3v3. However, you don't need an extra pull-up resistor for ESP-01S as CH_PD already has on-board pull-up resistor. This picture shows the different between ESP-01 and ESP-01S, visually ESP-01 has 2 LEDs on board near the antenna, while ESP-01S have two extra resistor between header pins and ESP8266EX chip, and with only one LED.
Download and install esptool
Download and install esptool from https://github.com/espressif/esptool. esptool
is a python application. You need to have python installed as well.
Download firmware 2.1
Download ESP8266 nonOS SDK - Release 2.1.x, noticed that this is not the latest version as the latest version doesn't works for ESP-01 based on my experience.
Upgrade the firmware
You will actually only need 4 files for the upgrade, I would suggest that you copy and paste those files into your esptool directory from the downloaded bin/
directory. cd
into your esptool directory and run the following commands to upgrade the firmware.
To put ESP-01 into programming mode:
- Press and hold Flash(GPIO0) button;
- Press Reset button once, this will put ESP-01 in programming mode;
- Press Reset to start the newly uploaded program when upload is completed.
./esptool.py --port /dev/cu.SLAB_USBtoUART write_flash 0x00000 boot_v1.7.bin
./esptool.py --port /dev/cu.SLAB_USBtoUART write_flash 0x01000 user1.1024.new.2.bin
./esptool.py --port /dev/cu.SLAB_USBtoUART write_flash 0x7c000 esp_init_data_default.bin
./esptool.py --port /dev/cu.SLAB_USBtoUART write_flash 0x3e000 blank.bin
./esptool.py --port /dev/cu.SLAB_USBtoUART write_flash 0x7e000 blank.bin
Please noted that /dev/cu.SLAB_USBtoUART
is the USB port for my USB-TTL interface, yours might be different, run ls /dev/tty.*
to find out your USB port
-
the AT binaries are published separately from SDK too. espressif.com/en/support/download/…2020年05月07日 12:11:31 +00:00Commented May 7, 2020 at 12:11
-
usual is to run esptool as one command started in the at firmware's folder
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
(this command is for AT 1.7 and 2 MB or more flash)2020年05月07日 12:13:57 +00:00Commented May 7, 2020 at 12:13 -
1@Juraj You have ESP-01 with 2MB? I never saw any ESP-01 came with 2MB flash unless I buy chip and replace it. Usually I saw it either come with 512kB or 1MB.hcheung– hcheung2020年05月07日 13:22:37 +00:00Commented May 7, 2020 at 13:22
-
I didn't say that it is for esp-01. I have a command for a 2 MB module so I pasted it as example.2020年05月07日 14:31:51 +00:00Commented May 7, 2020 at 14:31
-
I see. Thanks for the one liner.hcheung– hcheung2020年05月07日 14:37:27 +00:00Commented May 7, 2020 at 14:37
You use esptool.py
available from github.
It's exactly the same usage regardless of which operating system you are using (apart from the serial port device name of course), so instructions for Linux (for example) are the same as instructions for Mac OS X.
The OP doesn't need to upgrade the ESP's firmware, despite that that's what the question said. They apparently want to change its baud rate. That is doable with an AT command in the existing firmware, as described @hcheung described in a comment.
See my answer to a similar question here, noting especially, the last few lines of that post which is essentially a script for manually making the change. Note also, that this is not at all host operating system specific; everything is done with a sketch like the one in that question, and the Arduino IDE Serial Monitor.
AT+UART_DEF=9600,8,1,0,0
to make the change, the command_DEF
will make the setting persistent.