How to burn AT firmware to esp01 with UNO R4

Hello everyone, I recently received a new UNO R4 board and plan to migrate my project to UNO R4. Previously, I used the circuit in the figure below and connected the reset pin of UNO R3 to GND. Then I used this script to burn the AT firmware into ESP01.


@REM esptool.exe --chip esp8266 --before no_reset_no_sync write_flash 0 "v0.9.2.4 AT Firmware-ESPFIX.bin"

esptool.exe --chip esp8266 --before default_reset erase_flash

esptool.exe --chip esp8266 --before default_reset write_flash 0 "BAT_AT_V1.7.1.0_1M.bin"

pause

Now, after switching to UNO R4 and connecting the reset pin to GND, my computer cannot detect the port anymore.

Can anyone tell me why and how can I solve this problem?

Thank you in advance for your time and expertise.


UPDATE: For people who encounter the same problem.

Thanks to @Juraj for providing the solution approach.

Also thanks to @ubidefeo and @ptillisch for providing reference information.

Here are the detailed steps I took to solve this problem:

hi @wulu

The old UNO is an AVR with a bootloader exposed on pins RX/TX (0/1) .
The new microcontroller uses DFU to burn the firmware.

Unless someone creates a Serial Bootlaoder for it (which is IMO pretty unnecessary) this will not be possible

1 Like

use the SerialPassthrough sketch with baud rate set to 115200. it will bridge the USB to RX/TX pins

1 Like

Hi @wulu. I see the other helpers have already provided the answer while I was writing, but since there is maybe a little more information I'll post my reply anyway:

One of the significant differences between the UNO R3 and R4 is that the R3 has a dedicated USB chip (ATmega16U2) separate from the primary ATmega328P microcontroller. This means you can hold the ATmega328P on the R3 in reset without affecting the USB CDC serial port that is generated by the ATmega16U2. The primary RA4M1 microcontroller on the R4 is has native USB capability so it can be connected directly to the computer via the USB cable and produce the USB CDC serial port. That is why when you hold the RA4M1 on the R4 in reset mode you no longer get a serial port

The information that explains what you observed is here:

Note especially this:

This is one of the few things that are distinctly different from UNO R3 to UNO R4, as the UNO R3 only features one hardware serial port, that is connected to both the USB port and the RX/TX pins on the board.

1 Like

I understand that this example can be used to communicate with the AT firmware for configuring ESP01, but it seems like it cannot be used for firmware burning. Could you please explain more clearly? Thank you!

it can

1 Like

Thank you, it worked. :+1:
Here are the steps I took to succeed, hoping to help those who encounter the same problem:

There is no need to ground the RESET pin of R4 board.

  1. Swap the positions of TX and RX based on the circuit diagram provided earlier. That is, connect ESP01's TX to R4's RX and ESP01's RX to R4's TX. And do not ground the RESET pin of R4 board.

  2. Upload the following code to R4;

void setup() {
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop() {
  if (Serial.available()) {    
    Serial1.write(Serial.read());   
  }
  if (Serial1.available()) {  
    Serial.write(Serial1.read());   
  }
}
  1. Modify the firmware burning script.
esptool.exe --chip esp8266 --before no_reset_no_sync erase_flash

esptool.exe --chip esp8266 --before no_reset_no_sync write_flash 0 "BAT_AT_V1.7.1.0_1M.bin"

  1. Run the burning script.
1 Like