Newcomer prob: PlatformIO frequently failing to upload on OSX Big Sur/M1/Arduino Mega 2560 R3

Hello community, I’m struggling with PlatformIO 6.1.14/3.4.4 non-reliably uploading code onto the Arduino Mega Board; it typically runs the very first time after resetting/booting the computer. It runs sometimes after dis- and reconnecting the USB cable. The board shows up at /dev/cu.usbmodem11301

  • I tried explicitly mentioning that port in the INI file, but it does not make a difference
  • I can not find any concurrent drivers e.g. the SiLabs problem
  • Resetting the board does not help

It seems avrdude is the culprit (or victim) in the toolchain as the terminal states
Writing | avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
and it seems to happen during write since the line of # is not completed, rather the error message is interrupting the progress report:
Writing | #####################avrdude: stk500v2_ReceiveMessage(): timeout
What might be the reason, and what can I do to fix the issue?

If that board uses the same WCH uart as my ESP32-S3 boards, the problem is that the MacOS driver only mostly works with it. It works just well enough to make you think it’s working, but then secretly eats data.

It’s corrected by using a driver, I think it’s GitHub - WCHSoftGroup/ch34xser_macos: MacOS USB driver for USB to serial chip ch340, ch341, ch342, ch343, ch344, ch9101, ch9102, ch9103, etc , and then using /dev/wch.usbserialBIGNUMBER

This is a 100% fix for me and many others.

If it’s using a SiLab UART, then this probably doesn’t apply.

Edit: instructions at Mac Driver Installation | How To Install Drivers for WCH CH9102F USB to Serial Chips | Adafruit Learning System

1 Like

Thank you Robert I’ll have a look at that.
Going to the original Arduino IDE – an old version, 1.8.19; the 2.3.2 does not work – and (re)burning the bootloader seemingly fixed the problem; now PIO can upload to the board again … until next time.