Skip to content
Advertisement

How to use Arduino-Makefile with Sparkfun Pro Micro?

So, I am using Arduino-Makefile (https://github.com/sudar/Arduino-Makefile) and trying to program a 5V 16MHz Sparkfun Pro Micro (https://www.sparkfun.com/products/12640).

I am using the versions of the Arduino libraries and Arduino-Makefile in the repository of the Linux distro I am using (Linux Mint 17.2). These versions are 1.0.5 and 1.3.1 respectively.

My file structure looks like this:

JavaScript

My test.ino is taken directly from here: https://learn.sparkfun.com/tutorials/pro-micro–fio-v3-hookup-guide#example-1-blinkies and looks like this:

JavaScript

My Makefile, which is very short yet embarrassingly messy, looks like this:

JavaScript

Everything builds fine, but the programmer complains when I try a make upload. The Pro Micro is /dev/ttyACM0, which I have confirmed by doing an ls /dev/tty* with the device both plugged in and not plugged in and comparing the outputs.

Here is the result of a straight up make:

JavaScript

and the output of make upload:

JavaScript

Now, because of the error, I figure it’s something wrong with my configuration of the bootloader, but I am unsure. Maybe the programmer setting is wrong? I would appreciate any help! 🙂

Advertisement

Answer

Here’s what worked for me.

First, go to the hardware folder in your Arduino sketchbook or create it if it does not exist. Then extract the sparkfun addon files into the hardware folder. Your directory structure should look something like this:$SKETCHBOOK_DIR/hardware/sparkfun/avr/.

Then in your project directory use this makefile:

JavaScript

Then you should be able to run make and make upload. However, if your code does something that disables or overrides the default USB behaviour on the pro-micro, then Arduino-mk will not be able to reset the pro-micro into bootloader mode over USB. Instead short the GND and RESET pins twice to get into bootloader mode. Then make upload2 flash the pro-micro (Note: the pro-micro only stays in bootloader mode for 8 seconds).

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement