ESP Flasher

Give it a try, it costs you nothing !
Post Reply
User avatar
Electroguard
Posts: 836
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 268 times
Been thanked: 317 times

ESP Flasher

Post by Electroguard »

Hi Francesco,

Assuming a successfully flashed Wemos D1 Mini (for example) with appropriate serial drivers for that OS.
Could an Annex script make it function as a serial UART for flashing other Annex devices which don't have serial drivers available?, and also for using assigned gpios to autoflash Sonoffs etc without needing diode hacks?

If not (perhaps because of Annex timings or whatever) could it be feasible to flash the device with compiled arduino code to turn it into a serial UART for flashing other ESP devices?

It could be the perfect flashing interface.
Especially for wemos footprint devices which could use a triple base extender pcb with just a few (serial and gpio0) interconnecting tracks cut - the wemos footprint esp32 flashing pins are compatible with esp8266 pin locations.
User avatar
cicciocb
Site Admin
Posts: 1900
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1271 times
Contact:

Re: ESP Flasher

Post by cicciocb »

Hi Robin,
the flashing protocol is handled by the esptool program which is basically a program written in python.
Replicating this into a dedicated firmware / arduino should require some effort
It's not really clear to me why you would use another ESP module when you could just use a USB to serial adapter with the right drivers on the computer.
User avatar
Electroguard
Posts: 836
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 268 times
Been thanked: 317 times

Re: ESP Flasher

Post by Electroguard »

Was only a thought... I seem to remember arduinos being used for flashing instead of serial UART, so presumably an ESP could also - and it would have been a good bonus if an Annex device could have removed the need for a separate serial UART, but is not important.

What got me thinking is that some of my previously flashed devices are not recognised by MX linux, so need to be flashed manually.
I also remember us both having various serial driver problems with windows in the past, which even affected what devices we chose to buy.

I'm still making videos for Annex MX, and if it causes any Annex interest with linux users when published, then they may need to flash manually with some sort of serial flasher... so was just wondering if there might be a better alternative to the usual 'non-intelligent' serial UART.
User avatar
cicciocb
Site Admin
Posts: 1900
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1271 times
Contact:

Re: ESP Flasher

Post by cicciocb »

Ok, now I understand what you mean.
It should be possible but I fear that the autoreset functionality will be an issue because the "intermediate" module will not understand if we are flashing it or the connected one.
User avatar
Electroguard
Posts: 836
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 268 times
Been thanked: 317 times

Re: ESP Flasher

Post by Electroguard »

What triggers the autoreset, how does it actually work ?
And what would be the implications of not having autoreset, would it just be a matter of the newly flashed device simply waiting for a manual RST or power Off/On to reboot up with the new firmware ?

An ESP flasher made from an ESP is not a 'must have'... but it could be an interesting addition to the Annex stable if feasible.
User avatar
cicciocb
Site Admin
Posts: 1900
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1271 times
Contact:

Re: ESP Flasher

Post by cicciocb »

Hi Robin, this is the schematic of a Wemos D1 Mini.
image.png
As you can see in this part of the schematic, the reset and the GPIO0 are managed by the USB to Serial chip using the signals DTR and RTS.
image.png
These signals are managed automatically by the esptool utility to put the module in programming mode.
https://docs.espressif.com/projects/esp ... ction.html

This can eventually be disabled using a command line option
https://docs.espressif.com/projects/esp ... tions.html

Another difficulty is that the ESP8266 has only one serial port available (the 2nd one cannot be used) so the other port can only be a software serial that is not really reliable and is limited at 115200 baud; not a real limitation, just the process will be longer
You do not have the required permissions to view the files attached to this post.
User avatar
Electroguard
Posts: 836
Joined: Mon Feb 08, 2021 6:22 pm
Has thanked: 268 times
Been thanked: 317 times

Re: ESP Flasher

Post by Electroguard »

That actually seems quite encouraging Francesco - it means that any esp device whose on-board usb to serial interface is recognised by the OS could be used to manually flash any other un-recognised esp device by manually rebooting it ready for flashing by holding its gpio0 low.
If the 'programmer' is esp8266 then it will need to connect to the device to be flashed using serial2 at less than full speed, but at least it should do the job ok.

Hopefully the next multi-platform Toolkit update might include a checkbox option to enable or disable the "--before no_reset" commandline option.

I noticed mention of linux in https://docs.espressif.com/projects/esp ... ction.html
"In Linux serial ports by default will assert RTS when nothing is attached to them. This can hold the ESP8266 in a reset loop which may cause some serial adapters to subsequently reset loop. This functionality can be disabled by disabling HUPCL (ie sudo stty -F /dev/ttyUSB0 -hupcl)"

I suspect that it would be more likely to cause flashing problems rather than preventing usb to serial interfaces from being recognised, but I will do some tests on my devices to see if it makes any difference.
Post Reply