This is what I get after the software detects the COM port in use:
Serial port COM4
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.
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?
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.
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.