Arduino Micro uploading problem experiments report

Hi, I've read several threads and guidelines about Arduino Micro programming problems. But no one seem to solve them. So I share my experience

Problem description: Micro is known for sharing the two serial ports and resetting the USB serial port during the programming procedure. The IDE programmer is said to wait until new serial port appears (after resetting) It is likely the cause of uploading issues. Many users report their Micro won't upload successfully. Guidelines tell to try resetting the device manually before uploading and to try and find appropriate delay between manual reset and upload attempt.

After many hundreds of attempts, I've found this is the most successful procedure: (using Ubuntu and the last IDE 1.6.7):

  • The IDE must be run by superuser (with sudo).
  • reset Arduino only if the serial port is not visible. Wait for the serial port to appear ( /ttyACMxx ).
  • Check the serial port ( /ttyACMxx ) if IDE haven't done so automatically.
  • Click upload and wait

But even this way uploads properly in approx. 1 of 15 attempts. I have tried with different Micro device and it is the same.

So I extracted the uploading into a following scripts.
Firstly we need to reset the device and put it to programming mode by changing the baudrate to 1200(I think this is the case of Micro only, right?)
I've created an executable script ardureset (takes the serial device as a parameter):

#! /usr/bin/python
import sys
import serial
ser = serial.Serial(sys.argv[1], 57600)

Then I've created uploading script (this takes the compiled binary as a parameter)


# find device port file up to /dev/ttyACM30
function findport
  while true
    if [ -e "$DEVFILE" ]; # if file exists. -f (readable) doesn't work
    if [ $PORT == "31" ]
      echo over port number 30
      exit 254
  echo found port $DEVFILE

findport # find the first existing Arduino serial port, sets variable $DEVFILE
echo Resetting device
./ardureset $DEVFILE
sleep 1 # doesnt't work without this delay after the reset
findport # find the port again, many times it changes the number
/home/mike/arduinoinstall/hardware/tools/avr/bin/avrdude \
  -C/home/mike/arduinoinstall/hardware/tools/avr/etc/avrdude.conf \
  -v -patmega32u4 -cavr109 -P$DEVFILE -b57600 -D \
killall avrdude_bin # many times avrdude_bin stays running and consumes all CPU power

But although this should be the exact copy of the procedure performed by IDE, not once did it upload the binary to the Micro. I've tried experimenting with the delays, baudrate, different programmers, but with no success. At least I hope this might help others to carry on looking for the problem solution. Please reply if you have any progress.

I have tried another way. Instead of resetting Micro by baudrate change I doble-press the reset button. (removed the resetting part from the script, now it only searches the port and calls avrdude) It launches the loader OK(soft-blinking LED, then I run the script), but still no success uploading the binary.