Uploading firmware to the Pro Micro - AndunHH/spacemouse GitHub Wiki

Compiling and flashing the firmware with arduino IDE

  1. Configure your boards, see Custom board to emulate the space mouse
  2. Open the Arduino IDE
  3. Open spacemouse-keys.ino
  4. Select Tools -> Board -> SparkFun AVR Boards -> Spacemouse (If you followed another boards.txt instructions, which also allow 3.3V with 8 Mhz: Make sure to select the proper processor: 5V 16MHz)
  5. Select the correct port (see troubleshooting section, which might be necessary for first upload)
  6. Compile the firmware
  7. Upload the firmware

Troubleshooting uploading

The following steps are useful, if you can not upload to you Pro Micro.

Disconnect the pro micro and check your ports in the arduino IDE. Connect the pro micro and check if a new port has shown up. Remember it, because you need to select it as the Port.

If you didn't find a new port, you need to bring the pro micro into the bootloader: Usually, the pro micro has a short time to get into the bootloader of 800 ms after power up, which is easy to miss. You can change the boot loader time to 8 s: Power up the pro micro and connect the reset pin twice to gnd. (Use a screw driver to create a short circuit between RST and GND, release it and connect it again).

You can read the details for this reset here: Reset to bootloader

After such a double reset, look if there is an additional USB port and remember which it is.

Start over again with the known port:

  1. Compile the firmware and wait for it to complete.
  2. Do the double reset
  3. Quickly select the correct port
  4. Hit "Upload" or strg+U.

If you were able to select the correct port in 3 once, you may skip this step in the next try, because the arduino IDE remembers this selection. Then, you can change the order to:

  1. Compile the firmware and wait for it to complete.
  2. Hit Upload
  3. Do the double reset, while the upload process is initiated.

This steps are a little bit complicated, but they are only necessary for the very first upload (or if you bricked your device with wrong firmware or board selections). Focus on finding the correct port first. If you can't select the correct port, don't even try hitting on upload. Focus on finding the port first. Secondly, get the timing for the upload right. Even if you now, what you are doing, this may take up to five retries.

Typical error messages ...

... that could bring you to this site

avrdude: ser_open(): can't open device "\.\COM7": acces denied
Upload failed: Upload Error: exit status 1