USB Device Drops During or After Upload with Adafruit M0/M4 Feather Express Boards

I’m having trouble reliably uploading firmware to Adafruit M0/M4 Feather express boards. The USB device disconnects in several circumstances:

  • During an upload the firmware progress bars show an upload is in progress, then an error message shows up and the upload files
  • Sometimes the upload proceeds successfully, but then the board does not reconnect. So I can’t monitor the serial port for output. I make several attempts to reconnect the board including:
    • Hitting the reset button on the board.
    • Putting the board into boot loader mode by double tapping the reset button.
    • Physically disconnecting the board and then reconnect it.
    • If I look for the USB device in the /dev directory or in Windows device manager it does not reliability show up.
  • Sometimes the works, but most of the time the board does not reconnect.

Here are the things I’ve tried to fix the problem:

  • Upgraded to latest version of Platform IO:
pio --version 
>>>PlatformIO, version 4.3.4
  • Tried different machines with different operating systems. So far I’ve tried:
    • macOS Catalina
    • Ubuntu 19.10
    • Windows 10 (Insider Edition on the fast ring).
    • Rasbian Buster through platformio remote
  • Upgraded to latest boot loader on board. I’m running Adafruit v3.1 bootloader for the boards.
  • Forced v3.6.1 of bossic as recommended in this post.
  • Changed the Reopen Serial Port Monitor Delay from 0 to 2000 in VS Code from the same post above.
  • I have several different boards. I’m having the same problem on each.

Here are some relevant outputs:

user@MacBook-Air projec_dir % pio device list
Hardware ID: n/a
Description: n/a

Hardware ID: n/a
Description: n/a

Hardware ID: USB VID:PID=239A:801B SER=889DB1EA504D5257342E314AFF0B1826 LOCATION=20-2
Description: Feather M0 Express

user@MacBook-Air projec_dir % platformio run --target upload -v --environment m0_express
Processing m0_express (platform: atmelsam@3.6.1; board: adafruit_feather_m0_express; framework: arduino; lib_deps: PololuMaestro)
PLATFORM: Atmel SAM 3.6.1 > Adafruit Feather M0 Express
HARDWARE: SAMD21G18A 48MHz, 32KB RAM, 256KB Flash
DEBUG: Current (atmel-ice) External (atmel-ice, blackmagic, jlink)
 - framework-arduinosam 4.1.190506 
 - tool-bossac 1.10900.0 (1.9.0) 
 - toolchain-gccarmnoneeabi 1.40804.0 (4.8.4)
LDF: Library Dependency Finder ->
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 9 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <PololuMaestro> 1.0.0 (/Users/mgandhi/.platformio/lib/PololuMaestro)
Building in release mode
MethodWrapper(["checkprogsize"], [".pio/build/m0_express/firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]   7.9% (used 2596 bytes from 32768 bytes)
Flash: [=         ]  12.5% (used 32760 bytes from 262144 bytes)
.pio/build/m0_express/firmware.elf  :
section            size        addr
.text             32408        8192
.data               352   536870912
.bss               2244   536871264
.ARM.attributes      40           0
.comment            112           0
.debug_frame       3068           0
Total             38224
<lambda>(["upload"], [".pio/build/m0_express/firmware.bin"])
AVAILABLE: atmel-ice, blackmagic, jlink, sam-ba
CURRENT: upload_protocol = sam-ba
BeforeUpload(["upload"], [".pio/build/m0_express/firmware.bin"])
Auto-detected: /dev/cu.usbmodem14201
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem14201
Waiting for the new upload port...
bossac --info --debug --port "cu.usbmodem14201" --erase --write --verify --reset -U --offset 0x2000 .pio/build/m0_express/firmware.bin
No device found on cu.usbmodem14201
*** [upload] Error 1
================= [FAILED] Took 11.52 seconds =================

Environment     Status    Duration
--------------  --------  ------------
m0_express      FAILED    00:00:11.523
m4_express      IGNORED
m0_black_magic  IGNORED
============ 1 failed, 0 succeeded in 00:00:11.523 ============


platform = atmelsam@3.6.1
;platform =
board = adafruit_feather_m0_express
framework = arduino
lib_deps =

platform = atmelsam@3.6.1
board = adafruit_feather_m4
framework = arduino
lib_deps =

Please let me know if there is a fix or additional troubleshooting steps. At this point I’m considering switching boards to something more reliable.

@mgandhi I too am frustrated by this issue. Have you tried using the Arduino editor. I do not have these issues with that editor and uploading. However I don’t want to use it. I want to use PlatformIO. Because of this I am not convinced that this is an issue with the Adafruit boards. There must be something in the board definition or how PlatformIO talks to it. You were using a Feather. I have also tried the ItsyBitsy M4.

When I try to upload I have to double press to force boot loader mode. This should only need to be done once when using the Arduino editor. The uploader tries until 50-80% then stops. We don’t get to the verify stage. I do this several times, and eventually I will get it to upload successfully. No changes to code. Very frustrating.

And the upload behavior is flawless in the Arduino IDE? With which Adafruit SAMD core version and which board settings is that exactly?

This might have been fixed now (since OP) and just user error (for me). I was struggling with this for a few days, but it is working now. Not sure what my originally issue was anymore, but I posted that it works for me here Inconsistent Problems uploading to an Adafruit M4.

1 Like