How to Erase and Flash an ESP32 module

Discussion and support for the Nmea4Wifi multiplexer - a 4-input Nmea 0183 wifi multiplexer.
Post Reply
Luis Sa
Site Admin
Posts: 535
Joined: Thu May 04, 2017 4:12 am

How to Erase and Flash an ESP32 module

Post by Luis Sa » Sat May 08, 2021 10:42 pm

Hello,

In this tutorial post, I describe how you can erase and flash an ESP32 module with a NMEA4WIFI BIN file without using the Arduino IDE. In some circumstances you may need to do this. I tried this method using Windows 10. I am not sure if you can use another OS. You need to download a tool from ExpressIf, the manufacturer of the ESP32. The tool is is available as a ZIP file called flash_download_tool_v3.8.7.zip that can be download from the ExpressIf or the Vela-Navega website. You need an USB data cable to connect the PC to the ESP32 module and take a note of the COM port that Windows attributes to the USB adapter. If your multiplexer is of the TH (Trough Hole) type you could remove the module from the multiplexer as the USB cable also supplies power to the module. After you download the flash_download_tool_v3.8.7.zip file, you unzip it and run the executable flash_download_tool_v3.8.7.exe. You may need to run this programme as an administrator. When the programme starts it will present a window where you should select ESP32 as the Chip Type and develop as the WorkMode. Then, when you press OK, you receive 2 windows - one with a black display running in the background and the ESP32 user interface running in the foreground

flash-0.jpg

You should choose the parameters as shown in the picture and in particular choose your COM port number and the BAUD rate of 921600, at the bottom right corner. In my case the COM port number is 24. At this stage the green square shows IDLE. Pressing START in the line below, you get information about the ESP32 module as shown in the following picture. That means that the USB cable connection between the PC and the ESP32 module is working.

flash-1.jpg

At this time, you SHOULD DO AN ERASE and wait until the tool finishes. In doing so, you erase all the contents of the ESP32 and will start with a blank ESP32.

Now I suggest you create a TEMP folder to place there the needed BIN files to flash the module. You will need 4 files. One file is the main file that you can download from the Binary Updates List. You also need 3 additional BIN files contained in the archive FlashBins.zip. Here are the 4 files placed in the folder C:/TEMP:

flas-a.gif
flas-a.gif (4.79 KiB) Viewed 426 times

Now you have to specify these 4 files together with the addresses were the files will be uploaded. This is shown in the following picture. For example the file boot_app0.bin goes to address 0xe000. In the picture we show the final stage of the flash operation. Actually, when we press START the progress green bar increases to the right and when the process terminates the green square box shows FINISH.

flash-2.jpg

If you had the module removed from the multiplexer PCB you need to reinsert it, respecting its original orientation. The multiplexer will run the uploaded firmware: in this case version 4.4!


Regards, Luis

Zamino
Posts: 3
Joined: Fri May 07, 2021 7:52 pm

Re: How to Erase and Flash an ESP32 module

Post by Zamino » Sun May 09, 2021 4:56 pm

Hi Luis,
I tried to follow your instruccions, but no luck. The device is connected via USB, the light is on but on 2 different PC's with Win-10 and 3 different PC's with Win-7 I dont get a USB connection. The device just isnt recognized, even chanded the USB port (2.0 and 3.0).
I tried various USB drivers, but no luck.
So here I am stuck.
The demo device works ok, so all testing I want to do can go ahead.
If you dont have other suggestions i will send it back to you an hope for an exchange.
If you need any other information I will gladly send it to you.
As i am planning to to flight to Portugal on 19 of May it would be great if you could send me an other one in the next days.
As soon as I get your confirmation I will send mine.

Kind Regards, shit happens as we all know

Werner

Luis Sa
Site Admin
Posts: 535
Joined: Thu May 04, 2017 4:12 am

Re: How to Erase and Flash an ESP32 module

Post by Luis Sa » Sun May 09, 2021 6:01 pm

Hello,

Thanks for your reply. I can send you a replacement unit tomorrow. But it would be more secure if I could send it to the marina here in Portugal. They would receive it on Tuesday and I could phone them just to make sure that someone receives it and keeps it until your arrival. The reason for that is that there are delays from Portugal to UK. You are in UK, right? Also you can return your unit when you arrive. You can do it at any post office.

Maybe we could deal with this by email. But could you confirm here if you made an erase followed by fresh flash as described? Or you was not able to get communication between the flash tool and the multiplexer?

Regards, Luis

Zamino
Posts: 3
Joined: Fri May 07, 2021 7:52 pm

Re: How to Erase and Flash an ESP32 module

Post by Zamino » Sun May 09, 2021 7:38 pm

Hi Luis,

I am from Germany.
No, I couldn’t do any erasing as I didn’t get a connection between multiplexer and flash tool.
Windows 7 and 10 didn’t recognize the usb connection.
Sending to my marina will not help me, as all the stuff for testing is here In Germany, besides my Marina is in Spain just 30 km from the Portuguese border. I will take the demo device down with me to get ais, gps and maybe some readings from B&G network devices on my boat laptop and try other stuff later when I am home again in autumn.
An idea: maybe the fault is just in the uppermost chip, which is exchangeable. As you hear I’m very good at electronics (joke). Maybe we should just exchange the esb32 which I assume is the uppermost chip

Luis Sa
Site Admin
Posts: 535
Joined: Thu May 04, 2017 4:12 am

Re: How to Erase and Flash an ESP32 module

Post by Luis Sa » Sun May 09, 2021 8:49 pm

Hello,

I do not understand if you have a SMD or a TH Nmea4Wifi multiplexer. Could you send me a photo?

Here is something you will find on the nmea2wifi forum. It applies also to the Nmea4Wifi multiplexer.


The first time you insert the USB cable in your computer (with the module on the other extreme of the cable) Windows will try to communicate with the CH340 integrated circuit that exists the Nmea2Wifi multiplexer and tries to install the drivers for that integrated circuit. If it fails (eg if you receive a warning saying that the hardware was not properly installed) you need to install those drivers by downloading this file: CH34x_Install_Windows_v3_4.zip. You unzip the file into a temporary folder and run the executable. You get this window .... please find the post e read what follows as I am not able at this moment to paste the link here.

Regards, Luis

Zamino
Posts: 3
Joined: Fri May 07, 2021 7:52 pm

Re: How to Erase and Flash an ESP32 module

Post by Zamino » Mon May 10, 2021 3:48 pm

Hi Luis,

Windows does not recognize the USB connection. It does not ask for a driver, the new/additional USB port isnt shown, no new/additional Com port, ust nothing. The only thing I notice, the light on the multiplexer gets on and stays on, so electrical connection is made. I tried to install the CH34x driver but got an error during installation.

dagnall
Posts: 164
Joined: Wed Mar 04, 2020 6:36 pm

Re: How to Erase and Flash an ESP32 module

Post by dagnall » Mon May 10, 2021 4:26 pm

Zamino,

The CH340 driver is not easy to install, but is essential as I am sure you realise!.
You should be able to find a Youtube video to help, but I found this one OK. Its from Sparkfun but works ok.
I do not know of any instructions in German to help, but I am sure Google will help you!.

If you can post the "error" you get, that might help.

If you can install Arduino, then there are some other ways that we can help to install the .bin once you have the USB port recognised by the PC.

Dagnall

dagnall
Posts: 164
Joined: Wed Mar 04, 2020 6:36 pm

Re: How to Erase and Flash an ESP32 module

Post by dagnall » Mon May 10, 2021 4:34 pm

PS.

This is the link to the Sparkfun CH340 install instructions
This includes links to where to download the CH340 drivers.
Dagnall

Luis Sa
Site Admin
Posts: 535
Joined: Thu May 04, 2017 4:12 am

Re: How to Erase and Flash an ESP32 module

Post by Luis Sa » Mon May 10, 2021 6:02 pm

Hello Zamino,

A replacement unit was sent today. Still it would be useful for us to know why you could not have a message from Windows telling that new hardware was found or that a driver should be installed.

Dagnall has posted useful information about the driver for the CH340. You have a mini (not micro) USB cable. You say that you see leds blinking which means that power reached the multiplexer. My question is - are you sure that your USB cable is a data cable?

Regards, Luis

dagnall
Posts: 164
Joined: Wed Mar 04, 2020 6:36 pm

Re: How to Erase and Flash an ESP32 module

Post by dagnall » Tue May 11, 2021 9:21 am

Luis Sa wrote:
Mon May 10, 2021 6:02 pm
My question is - are you sure that your USB cable is a data cable?

Regards, Luis
Luis. That is a VERY good point, I have rather too many "power only" USB cables. These were either supplied with some products as power cables, but I also have some where the data wires just broke!.

Dagnall

Post Reply