palatis / arduino-lufa Goto Github PK
View Code? Open in Web Editor NEWLUFA (Lightweight USB For AVRs) on the Arduino!
License: MIT License
LUFA (Lightweight USB For AVRs) on the Arduino!
License: MIT License
I stumbled upon this repo while trying to get lufa working on a leonardo board and decided to give it a shot.
with the 1.6.12 version of arduino studio, the files mentioned in the installation section changed:
HID.cpp doesn't exist anymore
the line numbers in Arduino.h and main.cpp are off
the lines meant for main.cpp are already there
Platform.h doesn't exist anymore
I'm not sure what route I'll go from here to get lufa working, if it is relevant to this repo, there will be a pull request, if you or anyone else knows how to do it now before that that'd be even better.
I'm trying to get this library to work with a Arduino nano ble 33 IOT which uses a Samd21 processor. What would the best way be to go about this?
Thank you!
Hi,
Followed the instructions and compiled for the Arduino Leonardo. Uploaded and everything worked fine using the LUFA_DualVirtualSerial example.
I wanted to makes some changes, but have been unable to upload the modified project.
I get:
avrdude: butterfly_recv(): programmer is not responding
I get the same result on PORT6 and PORT7.
I've tried hitting the reset switch once the PORTS string appears, but this doesn't help.
Any thoughts on what I'm missing?
Full log here:
https://pastebin.com/j0VtwK5Y
Cheers,
Matt.
From #4:
Additionally, it seems to me like there is little reason to actually execute step 3 of the installation instructions. Step 4 seems to be enough. I could see the argument of wanting to give more accurate error messages to people who accidentally import libraries using the USB core.
Either way, it would be enough to just append .removed to the filenames of these files and to enclose the lines in step 4 with #if 0 and #endif or /* and */. This way it would also be easier to activate and deactivate LUFA in a regular Arduino installation. To implement this, I'd write a simple script that does exactly what I described above, and another one to reverse these changes.
To make these two scripts cross-platform, I'd implement them in Python. The deactivate script would import the activate one for all paths, so it can be guaranteed that it always perfectly reverses what the activate script did.
Maybe "activate" and "deactivate" aren't prefect names for these yet, I'm open to suggestions on that front.
Another idea would be to ship the LUFA.h file with an #error
directive that gets commented out by the activate script to give a descriptive error message when a user tries to include the LUFA library without activating first. In the same vein, instead of renaming the USB-related files, we could just insert an #error
directive at the top of each of them, so when a user tries to compile another project that uses the Arduino USB stack, they get a descriptive error message as well.
Thoughts?
I’m an armature wen it come to this things and I wanted to know if I can use this in windows.if it is imposible it’s fine because a can use and raspberry pi but I don’t know if installation process is the same
There is no <arduino_install_path> library of arduino IDE
In the latest version of LUFA - 170418 - a very old bug in the signature of CALLBACK_USB_GetDescriptor
was fixed.
As a result, the DualVirtualSerial example is not compatible with this version. I'll create a pull request to fix this.
Changes have been made so that LUFA could be enabled/disabled by selecting a board type after running the new "install.py" python script.
While this enhances the workflow, there is still room for improvement as the Arduino IDE has a "board manager" which is meant for new boards installation (as used by Adafruit and other third party boards manufacturers), which would allow the end user to install the new boards without having to install python or even use the commandine at all.
I've got a PoC working on this branch : https://github.com/CrazyRedMachine/Arduino-Lufa/tree/library
Sketch -> include library -> Add ZIP library...
, select the zip file downloaded in step 1.Library is now installed
File -> Preferences -> Additional Boards Manager URLs
: https://github.com/CrazyRedMachine/Arduino-Lufa/raw/library/custom_boards/package_arduino-lufa_index.json
Tools > Board > Boards Manager
, wait for the list to load then type LUFA in the search boxBoards are now in the board list
library.properties
filepackage_arduino-lufa_index.json
contents to reflect the Palatis repo rather than my forkalso a nice to have feature would be a generate.py script to automatically generate a new custom boards zip with new version number and the relevant data to be appended to the index.json... but i'm not sure yet if that's a good idea because it might break stuff and sometimes making changes to that might require further human intervention anyways...
I entered the following url https://github.com/Palatis/Arduino-Lufa/raw/master/package_arduino-lufa_index.json
as the additional board within the preferences.
Your URL within the package_arduino-lufa_index.json file is not working. You don't have a version tagged under this Git repo.
Try for example this link yourself: https://github.com/Palatis/Arduino-Lufa/archive/refs/tags/1.0.zip (it's not found!)
This will most likely gives a lot of problems, since I think the Arduino IDE 2 won't download or install this project. For example I'm also missing the examples (only see built-in examples):
i install the older arduino version and the newer ,i hav the same error
Arduino : 1.8.3 (Windows 10), Carte : "Arduino/Genuino Uno"
In file included from C:\Program Files (x86)\Arduino\libraries\LUFA/LUFA/LUFA/Drivers/USB/USB.h:383:0,
from C:\Program Files (x86)\Arduino\libraries\LUFA/LUFA.h:11,
from C:\Program Files (x86)\Arduino\libraries\LUFA\examples\LUFA_DualVirtualSerial\LUFA_DualVirtualSerial.ino:9:
C:\Program Files (x86)\Arduino\libraries\LUFA/LUFA/LUFA/Drivers/USB/Core/USBMode.h:260:7: error: #error USB_DEVICE_ONLY is not available for the currently selected microcontroller model.
#error USB_DEVICE_ONLY is not available for the currently selected microcontroller model.
^
C:\Program Files (x86)\Arduino\libraries\LUFA/LUFA/LUFA/Drivers/USB/Core/USBMode.h:271:6: error: #error The currently selected device, USB mode or architecture is not supported.
#error The currently selected device, USB mode or architecture is not supported.
^
In file included from C:\Program Files (x86)\Arduino\libraries\LUFA/LUFA/LUFA/Drivers/USB/Core/USBController.h:150:0,
from C:\Program Files (x86)\Arduino\libraries\LUFA/LUFA/LUFA/Drivers/USB/Core/USBTask.h:47,
from C:\Program Files (x86)\Arduino\libraries\LUFA/LUFA/LUFA/Drivers/USB/USB.h:386,
from C:\Program Files (x86)\Arduino\libraries\LUFA/LUFA.h:11,
from C:\Program Files (x86)\Arduino\libraries\LUFA\examples\LUFA_DualVirtualSerial\LUFA_DualVirtualSerial.ino:9:
C:\Program Files (x86)\Arduino\libraries\LUFA/LUFA/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h:114:5: error: #error No PLL prescale value available for chosen F_USB value and AVR model.
#error No PLL prescale value available for chosen F_USB value and AVR model.
^
exit status 1
Erreur de compilation pour la carte Arduino/Genuino Uno
Ce rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences.
thank for your help
I'm trying to read an sdcard file within my lufa sketch but including the arduino <SD> library will give compile errors when the LUFA board is selected. What should I do to use it as I would normally do? .
I am on Ubuntu 18.04 and using Arduino 1.8.3 since the activate.py script seems to want this version.
I am trying to compile the example program. I have run activate.py and it's output was all successes.
Here is the error message:
Archiving built core (caching) in: /tmp/arduino_cache_770586/core/core_SparkFun_avr_promicro_cpu_16MHzatmega32U4_4ec126580105bbcfef3f91ee9bd9669d.a USBCore.cpp.o (symbol from plugin): In function
RxLEDPulse':
(.text+0x0): multiple definition of __vector_11' sketch/LUFA.c.o (symbol from plugin):(.text+0x0): first defined here USBCore.cpp.o (symbol from plugin): In function
RxLEDPulse':
(.text+0x0): multiple definition of __vector_10' sketch/LUFA.c.o (symbol from plugin):(.text+0x0): first defined here collect2: error: ld returned 1 exit status exit status 1 Error compiling for board SparkFun Pro Micro.
If there are a manner of doing this in KISS mode I will appreciate to know.
And thank you anyway for the project.
Hi!,
I'm trying to include SD or SdFat library on a LUFA project but I get build errors.
The project corretly build with "Arduino Leonardo" board, but fail with the "Arduino Leonardo (LUFA)" board:
In file included from C:\Program Files (x86)\Arduino\libraries\SD\src/SD.h:21:0, from C:\Users\frolando.DLC0YLZW2\Desktop\SD-1.2.4\examples\Files\Files.ino:3: C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFatUtil.h: In function 'void SerialPrint_P(const char*)': C:\Program Files (x86)\Arduino\libraries\SD\src/utility/SdFatUtil.h:63:5: error: 'Serial' was not declared in this scope Serial.write(c); ^~~~~~
Here a project created for the tests:
#include <SPI.h>
#include <SD.h>#include <LUFA.h>
#include <LUFACDCSerial.h>File myFile;
void setup() {
if (!SD.begin(4)) {
while (1);
}// open a new file and immediately close it:
myFile = SD.open("example.txt", FILE_WRITE);
myFile.close();
}void loop() {
// nothing happens after setup finishes.
}
I've attached both logs.
Do you have any suggestions?
Thanks!
build_log_Arduino-Leonardo.txt
build_log_Arduino-Leonardo-(LUFA).txt
These are the installation instructions as of today:
- 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.h
after 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.h
after this step)- delete the stock USB stack from Arduino environment, there are 7 files to be deleted:
1.arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/CDC.cpp
2.arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/PluggableUSB.cpp
3.arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/PluggableUSB.h
4.arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/USBApi.h
5.arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/USBCore.cpp
6.arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/USBCore.h
7.arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/USBDesc.h
- edit the following files and remove the shown lines:
1.arduino-x.x.x_LUFA/hardware/arduino/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
2.arduino-x.x.x_LUFA/hardware/arduino/avr/cores/arduino/main.cpp
* 39:#if defined(USBCON)
* 40:USBDevice.attach();
* 41:#endif
I think a few things could be improved about this. First, it would be helpful to allow using LUFA as a git submodule instead of manually copying it. This way a user can just use git clone --recursive
to get everything they need.
Additionally, it seems to me like there is little reason to actually execute step 3 of the installation instructions. Step 4 seems to be enough. I could see the argument of wanting to give more accurate error messages to people who accidentally import libraries using the USB core.
Either way, it would be enough to just append .removed
to the filenames of these files and to enclose the lines in step 4 with #if 0
and #endif
or /*
and */
. This way it would also be easier to activate and deactivate LUFA in a regular Arduino installation. To implement this, I'd write a simple script that does exactly what I described above, and another one to reverse these changes.
This would mean that to install LUFA for Arduino, this command would be enough:
$ git clone --recursive https://github.com/Palatis/Arduino-Lufa.git LUFA; ./LUFA/activate
I'd be willing to implement this myself, any thoughts on the general idea?
Hello; thanks for your work here. When I upload the sample to a Leonardo board, on the serial console I see only partial messages, as if only the first byte of each print/println actually made it through:
This happens with the Arduino IDE 1.8.12 on both Linux (Ubuntu 19.10) and macOS 10.15.4. Am I missing something ? I tried all baud rates available.
Hi,
I'm pretty new to microprocessor development. I have a NodeMCU board, however, it doesn't seem to work with Arduino-Lufa. It's ESP-12/ESP8266-based, and with that being a different architecture, compiling this software for that board without extensive modification is out of the question, correct? Or am I missing something? My Arduino IDE can compile other Arduino software onto my NodeMCU just fine.
Thanks!
I have tried your example(DualVirtualSerial) but it doesn't work.
In the device manager, 2 new COM ports are shown. But I can't receive any data by use serial port utility(one sending and one receiving).
I'm not sure if I have missed any thing.
Thanks a lot.
I was wondering what would be required for me to implement different endpoint 0 sizes, where in existing code would the changes have to be implemented.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.