I'm trying to get the ATMega8U2 code compiled and loaded for a custom board I'm working on. I'm after the same functionality that the Uno and Mega2560 have, with the 8U2 (and later boards, the 16U2) handling USB duties to program the board from the Arduino IDE.
However, I want to load our own USB Vendor and Product IDs to the code.
I'm able to successfully load the Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex onto the 8U2, and then successfully flash the main MCU with it--so I'm pretty sure the circuit is working fine.
However, when I load the Arduino-usbdfu.hex via the make clean; make; make program, and then load the Arduino-usbserial.hex via the make clean; make; make dfu, it seems to hang the chip, with the Arduino IDE showing "Serial port '/dev/tty.usbmodemfa131' already in use. Try quiting any programs that may be using it."
When doing it this route, I also get the "Bootloader and code overlap. Use --suppress-bootloader-mem to ignore" message from dfu-programmer.
I'm thinking that if I can combine the two hex files like the Arduino-COMBINED file, and then flash the chip via the AVRISPmkII, then I can solve the problem.
Question is, how do I combine both those files so that I can flash it all at once? Is it as simple as a concatenation of files?
Any other thoughts or suggestions?