Today I tried to actually compile the arduino firmware for the atmega16u2, however, without much success. It seems to be written for an unspecified version of LUFA different than the current release. Rather than try to guess what version it should be, I decided to instead try the demos included with LUFA. That turned out to be remarkably simple.
All you have to do is unpack the LUFA zip file, open a terminal in the directory of one of the demos, edit the Makefile to replace "at90usb1287" with "atmega32u4", "8000000" with "16000000", and "USBKEY" with "LEONARDO", edit the sources to remove all references to joystick and instead make it spew some text constantly, and then do:
make all
avr-objcopy -j .text -j .data -O ihex VirtualSerial.elf VirtualSerial.hex
avrdude -c usbtiny -p atmega32u4 -U flash:w:VirtualSerial.hex:i
(I have and USBTiny ISP programmer connected to pins 14, 15 and 16 of the Pro Micro.)
And it works — I get spam from the serial on the /dev/ttyACM0 device. Yay.
Sadly, I can't see any demo that would be reading from the serial, but I hope I can steal that from the Arduino firmware code.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
I'd suggest buying a pro micro (clone) with a 3.3V regulator and 8MHz crystal though, so you don't need any level-shifting later..
Are you sure? yes | no
I know there are 3.3V pro minis, but I haven't heard about 3.3V pro micros. Got a link?
Are you sure? yes | no
easiest way to find them on any platform is looking for "pro micro 8mhz"
Are you sure? yes | no
Thanks, ordered!
Are you sure? yes | no