I have the same application for both ESP32 and ESP8266 (the same functionality). The person, who is not an IT expert is expected to launch the dedicated installer program to upload the (first/new) version of the application. How can the installer (the program) detect what version of hardware is connected through USB? The goal is to upload the correct variant of he application. Is it possible at all?
1 Answer
You can attempt to get the "chip ID" from the target board using esptool.py
. The ESP8266 has a chip ID, but the ESP32 doesn't.
Running esptool.py --port <serial port> chip_id
will either tell you, amongst other things:
Detecting chip type... ESP8266
Chip is ESP8266EX
....
Chip ID: 0x00a70414
Or:
Detecting chip type... ESP32
Chip is ESP32-PICO-D4 (revision 1)
...
Warning: ESP32 has no Chip ID. Reading MAC instead.
You can do similar with the read_mac
command. In fact any operation on esptool.py
that interacts with the target first probes the target to find out what the target is and report it - commands like chip_id
and read_mac
are just nice simple examples that return minimal information and don't interact with the target more than just querying the chip.
-
I suppose that you can't do it wrong anyway, can you? I mean attempting to upload an ESP8266-program to an ESP32 or vice versa will probably just result in an error?– PMFFeb 23 at 7:43