Back to

Updating ESP firmware (2021)

Hi everyone,

Following the instructions to build the ESP firmware produces errors. This is likely from me accepting a library update platformio suggested a few days ago.

I get the following when building esp with python build esp -v:

.pio/libdeps/esp12e/RemoteDebug/src/utility/WebSocketsClient.cpp: In member function 'void WebSocketsClient::connectedCb()':
.pio/libdeps/esp12e/RemoteDebug/src/utility/WebSocketsClient.cpp:704:26: error: 'class BearSSL::WiFiClientSecure' has no member named 'verify'
  704 |         if(!_client.ssl->verify(_fingerprint.c_str(), _host.c_str())) {
      |                          ^~~~~~

This looks related to a recent library update breaking a dependency - some relevant information here perhaps.

Perhaps I can simply download the repository again to fix the problem…

So I’ve managed to get it building but it’s a bit of a hack.

In esp/.pio/libdeps/esp12e/RemoteDebug/src/utility/WebSocketsClient.cpp I simply comment out lines 704-708:

704         if(!_client.ssl->verify(_fingerprint.c_str(), _host.c_str())) {                   
705             DEBUG_WEBSOCKETS("[WS-Client] certificate mismatch\n");
706             WebSockets::clientDisconnect(&_client, 1000);
707             return;
708         }

So I managed to also update the firmware. Thanks for the new ESP firmware @victor

I wasn’t able to use the cellphone method as the file selection screen doesn’t show up - as noted may happen.

I used the ESPtool method. This wasn’t easy either as I was getting the serial error when calling the flash code:

# python and python3 have the same path
> sudo python --port /dev/ttyACM0 --baud 115200 write_flash 0x000000 ~/Downloads/ESP_firmware_098.bin
# serial not found error!

I thought/knew serial was installed - but it was installed to /bin/python but not ~/.platformio/penv/bin/python. I’m not quite sure why.

Regardless, due to how I setup my path for platformio export PATH="/home/cyrille/.platformio/penv/bin:$PATH" it was finding that python version first. So I just swapped my export command to the following:

> export PATH="$PATH:/home/cyrille/.platformio/penv/bin"
> which python

I wasn’t able to use the ‘echo’ version of getting the SCK2.1 listening so I just entered the shell and did esp -flash 115200.

It didn’t work the first time as the SCK2.1 wasn’t ready yet, but I tried again a second later and it was fine.

I received the following output:

Serial port /dev/ttyACM0
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 3c:61:05:df:ea:a0
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 451168 bytes to 336030...
Wrote 451168 bytes (336030 compressed) at 0x00000000 in 29.5 seconds (effective 122.3 kbit/s)...
Hash of data verified.

Hard resetting via RTS pin...

Having now updated both the SAM and ESP firmware - I’m now receiving data on my own MQTT server. Thanks!

I should note that I can get the esp -flash 115200 command working with screen (sudo screen /dev/ttyACM0) but not from arduino.

It sounds like a permission problem, maybe your user doesn’t have the rights to access /dev/ttyACM0 ?

Try a search for Arduino permission problem, sometimes you need to add your user to the dialout or uucp group, it depends on your system.