[SOLVED] Wemos Lolin32 Lite / CH340 Error when uploading


I already solved this issue, is it ok to post here then?

Situation: First time trying the WEMOS LOLIN32 LITE board (the regular LOLIN32 worked fine immediately).

When trying to upload any sketch, the error message is:

esptool.py v2.6
Serial port /dev/ttyUSB0
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
MAC: 24:6f:28:0a:fd:cc
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Configuring flash size...

A fatal error occurred: Invalid head of packet (0xA6)
A fatal error occurred: Invalid head of packet (0xA6)

The solution is to set the upload baud rate to 115200 (default was 921600).
To do this, go to tools -> Upload Speed -> 115200. For board, I selected WEMOS LOLIN32.

I think this is because of the (supposedly cheap) CH340 USB to Serial converter chip which can only handle the 115200 baud rate. That is why I think this could be a solution when having trouble with other boards that use the CH340.

I hope I was able to help someone,