This is what I get after the software detects the COM port in use:
Serial port COM4
Connecting....
A fatal error occurred: Timed out waiting for packet header
*** [upload] Error 2
The terminal process "C:\Users\Greg\.platformio\penv\Scripts\platformio.exe 'run', '--target', 'upload'" terminated with exit code: 1.
------------
What steps do I need to do to correct this? I am new to the program, but absolutely love what I see and would like to continue using it.
Sorry, Vital info needed: Win10x64, desktop PC, Have tried both CMD and Powershell. I get replies from the board itself when I select the serial monitor icon at the bottom of the window. I got replies when I edited PIO ini file.
What board (buy link)? are you using with what platformio.ini? If itâs an ESP8266 or ESP32, have you manually put it into bootloader mode (FLASH and RESET)?
It is a WEMOS D1 ESP32 chip. I have tried a generic ESP board as well. I can program the board via ArduinoIDE on either of my two COM ports. The terminal shows Com back from the board, but obviously, the board isnât getting programmed by PlatformIDE. I have reset the board repeatedly. It shouldnât have to be in FLASH mode, if I understand the board correctly.
I did have to adjust the Platformio.ini to allow for coms at 115200, and that com rate works fine.
I was thinking of using an external Terminal program?? Like the built-in WIN10 terminal program?
Where would I adjust the Com speed in PlatformIDE? In the .ini file?
I have set monitor_speed - 115200, but that only seems to adjust the comms between the board and the built-in terminal.
I found the file:
\usersâŚ\platforms\espressif32\boards\wenis_d1_mini32.json
Modified the âspeedâ: 115200 but it didnât work. Restarted VSC and still no go on that parameter.
The flashing / upload speed via the serial bootloader can be adjusted using upload_speed (docs), the baud rate for the serial monitor is monitor_speed. Since you have problems uploading, you need play with upload_speed.
arduinoIDE com port can be set to 500000 and I have used that successfully on existing code.
FYI. 460800 in PIO didnât work likely because of that difference.
Iâve made the experience that is a good practice to fix transmission rates in platformio.ini
as well as in your code - otherwise you rely on externally set values that are not controlled by you and could change without your intervention.
You sure thatâs 500000, and not 512000? As I can pretty much guarantee that one will work, and the other wonât!
Another thing to be aware of is the question of whether the upload process on the Arduino IDE is actually running at that speed or not. As I know the esptool uploader on the esp8266 automatically reverted to 460800 if you try to specify a speed above that (not sure if it still does that or not)⌠perhaps the ESP32 uploader does the same⌠you have to check the output of the upload to see what speed it actually uses.
If you are âseeing gibbeishâ ⌠you need to set the monitor_speed to the same as your Serial.begin() speed. If the upload is failing, you need to look factors such as is the upload_speed too fast for that board/your development environment, is the right COM port being used, is the cable/connector dodgy, and is the board resetting properly - sometimes the auto-reset is a bit dodgy.
Thank you. I need to give up on this software. The upload speed on the ArduinoIDE is set at 921600 like you show in the provided figure. I will try that speed in the upload settings on PlatformIO IDE and see if that works.
I donât like to give up, so I decided to load everything on a Win10 laptop that is only a year or so old.
I found the exact same issues, and the inability to program the Wemos D1. In addition, I tried a different board and the same error 1 or error 2 appeared. So, it isnât a speed or hardware issue.