I wasted a lot of yesterday playing with my new SparkFun Pro Micro development boards. I ordered some to try to debug all the issues reported to Arduino-Makefile regarding resetting ATmega32u4 boards (e.g. Arduino Leonardo):

So the fix I’m currently suggesting is going back to using Python for the reset script like we did before with ard-reset-leonardo, but merging in the functionality of ard-reset-arduino so we still have on script to reset “regular” Arduino’s using DTR twiddling and 32u4’s using the 1200baud open/close routine.

It seems to work on a Boarduino I made – basically an ATmega328p with CP2102 USB UART and Uno bootloader, and my Mega2560 and the Pro Micro’s.

It will also remove some requirements from packaging as we will no longer need help2man to make a manpage (which didn’t work well) and we won’t have a dependency on Device::SerialPort or any Perl modules, plus the script is self-documenting using argeparse so doesn’t need to be 50% comments like the Perl one.

The main waste of time was trying to switch between the Sparkfun bootloader on the Pro Micro’s and the regular Leonardo one they came with, but I can’t seem to tell the difference – unless I didn’t actually flash the bootloaders successfully. They both seemed to have the 8secs delay.

Update: I’ve confirmed that you can’t upload a bootloader (or read/write fuses) to the Pro Micro using USB, you have to use a USBASP (or ArduinoISP I guess) and then upload a sketch to set the relevant USB VID/PID from the boards.txt entries over USB.

SparkFun Pro Micro 5v 16MHz:

avrdude -v -patmega32u4 -c usbasp -U flash:w:Caterina-promicro16.hex \
   -U efuse:w:0xcb:m -U hfuse:w:0xd8:m -U lfuse:w:0xff:m

Makefile:

MONITOR_PORT      = /dev/ttyACM0
BOARD_TAG         = promicro16
ALTERNATE_CORE    = promicro
BOOTLOADER_PARENT = ~/sketchbook/hardware/promicro/bootloaders
BOOTLOADER_PATH   = caterina
BOOTLOADER_FILE   = Caterina-promicro16.hex
BOARDS_TXT        = ~/sketchbook/hardware/promicro/boards.txt

include /usr/share/arduino/Arduino.mk

dmesg output:

New USB device found, idVendor=1b4f, idProduct=9205
New USB device strings: Mfr=2, Product=1, SerialNumber=0
Product: Pro Micro 5V
Manufacturer: SparkFun Electronics

Arduino Leonardo:

avrdude -v -patmega32u4 -c usbasp -U flash:w:Caterina.hex \
   -U efuse:w:0xcb:m -U hfuse:w:0xd8:m -U lfuse:w:0xff:m

Makefile:

MONITOR_PORT = /dev/ttyACM0
BOARD_TAG    = leonardo

include /usr/share/arduino/Arduino.mk

dmesg output:

New USB device found, idVendor=2341, idProduct=8036
New USB device strings: Mfr=1, Product=2, SerialNumber=0
Product: Arduino Leonardo
Manufacturer: Arduino LLC

Update 2: SFE confirmed that their bootloader modifications only cover hardware reset and not software. So that’s why you still get the 8secs delay when you run “make reset” but not when you power the device up.