I was pulling my hair out due to the following upload error.
PlatformIO Error Message:
Configuring upload protocol... Looking for upload port... Auto-detected: COM9 Uploading .pioenvs\nodemcuv2\firmware.bin warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed *** [upload] Error 2 [ERROR] Took 12.46 seconds
Arduino IDE Error Message
Sketch uses 247147 bytes (23%) of program storage space. Maximum is 1044464 bytes. Global variables use 32336 bytes (39%) of dynamic memory, leaving 49584 bytes for local variables. Maximum is 81920 bytes. error: Failed to open COM7 error: espcomm_open failed error: espcomm_upload_mem failed error: espcomm_upload_mem failed
Things I tried:
- used a different NodeMCU (thinking hardware problem)
- Run Atom/PlatformIO as administrator (thinking insufficient permissions after update)
- flash blinky program (thinking my code was flawed)
Used Arduino IDE (thinking problem related to PlatformIO update)
Solution: Make sure you unplug any modules connected to GND and 3V pins. This is somehow making it impossible for your IDE to flash programs to the microcontroller.
(My theory: controller does not go into flash mode, despite pressing button when those pins are connected.)
Try to run your arduino and peripherals off the same poewr source (ground pins connected). This way, it flashes sucessfully and you don’t have to unplug and replug cables.
Arduino hardware issues waste so much time. I enjoy writing the firmware…not struggling to get it flashed onto the bloody microcontroller. It seems like every time I come back to it after some time off, I have to set it up all over again because some PlatformIO update or library update ruined the code.