Manual installation is somewhat tricky, because the stock USB stack is in the arduino core directory instead of a seperated library directory, so you cannot simply drop Arduino-Lufa to the library folder under your Sketchbook directory.
This install will make it so that LUFA can be enabled or disabled by selecting the correct type of board in the Tools > Board
menu of the Arduino IDE.
The following setup was last tested with arduino-1.8.13 and LUFA 170418
(but it should work with future versions, if there were no major changes)
You should not use the Arduino LUFA AVR Boards version for non LUFA projects.
-
clone the repository, drop it in your
arduino-x.x.x_LUFA/libraries(for instance, you should havearduino-x.x.x_LUFA/libraries/LUFA/LUFA.hafter this step. -
download LUFA, put everything under
LUFA/toarduino-x.x.x_LUFA/libraries/LUFA/LUFA(for instance, you should havearduino-x.x.x_LUFA/libraries/LUFA/LUFA/Drivers/USB/USB.hafter this step) -
copy the
arduino-x.x.x_LUFA/hardware/arduinofolder into a newarduino-x.x.x_LUFA/hardware/arduino-LUFAfolder -
delete the stock USB stack from Arduino LUFA environment, there are 7 files to be deleted:
arduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/cores/arduino/CDC.cpparduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/cores/arduino/PluggableUSB.cpparduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/cores/arduino/PluggableUSB.harduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/cores/arduino/USBApi.harduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/cores/arduino/USBCore.cpparduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/cores/arduino/USBCore.harduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/cores/arduino/USBDesc.h
-
edit the following files and remove the shown lines:
arduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/cores/arduino/Arduino.h- 233:
#include "USBAPI.h" - 234:
#if defined(HAVE_HWSERIAL0) && defined(HAVE_CDCSERIAL) - 235:
#error "Targets with both UART0 and CDC serial not supported" - 236:
#endif
- 233:
arduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/cores/arduino/main.cpp- 39:
#if defined(USBCON) - 40:
USBDevice.attach(); - 41:
#endif
- 39:
-
edit the following files and modify the lines accordingly:
arduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/platform.txt- 7: name=Arduino AVR Boards --> name=Arduino LUFA AVR Boards
- (optional)
arduino-x.x.x_LUFA/hardware/arduino-LUFA/avr/boards.txtLook for "name=" and add "(LUFA)" to the end of each matching line e.g.- 7: yun.name=Arduino Yún --> yun.name=Arduino Yún (LUFA)
- 49: uno.name=Arduino Uno --> uno.name=Arduino Uno (LUFA)
That's it! You can now try start the Arduino IDE and you'll find the Arduino LUFA AVR Boards in Tools > Board menu.
You can select one and compile the examples! :-)