Added NoUsb workaround for Leo/Micro devices

Had to add this workaround again since the Leo/Micro bootloader is coded
different than the HL2 which fixes this problem.
This commit is contained in:
Nico 2015-01-11 12:55:18 +01:00
parent 830e5871e5
commit 0926e6318d
2 changed files with 51 additions and 1 deletions

View file

@ -86,6 +86,22 @@ See *Project/USB-Serial* for a fully usable USB-Serial bridge and how to use the
In the CDC.h you can also see the new Control Line functions for advanced users.
Keep in mind that the USB_ENDPOINTs for the u2 Series are set to 16 bytes, so the Serial buffer is also smaller (normally 64b).
**If you don't want to use the USB-Core** you can also choose under *Tools/USB Core* "No USB functions" to get rid of the USB stuff
and save the ram for other stuff if you don't need it. You also don't need the HID Project essentially if you don't want to use the USB functions.
Due to a bad Leonardo/Micro bootloader you need to add an add an ISR into every sketch as workaround.
**This is not needed for HoodLoader2 devices**, since the bootloader does a true watchdog reset on reprogramming and not a simple application jump
(the usb clock is then still on and breaks any delay functions).
Checkout the 'Leonardo_Micro_NoUSB_Blink' example.
```cpp
// workaround for undefined USBCON has to be placed in every sketch
// otherwise the timings wont work correctly
ISR(USB_GEN_vect)
{
UDINT = 0;
}
```
### HoodLoader1 (legacy, new stuff coming soon)
**Try the HoodLoader1 example. It provides the basic Serial protocol API to send HID reports. You have to copy this to every sketch again.**
@ -131,6 +147,10 @@ Install HoodLoader2 and flash the hex file. If it works please leave me some inf
Troubleshoot
============
**Any random weird problem** is mostly solved by a pc reboot or a port switching. Try another (USB2.0) port if you have any problems with your device.
You might also try it on another pc to see if your OS mixes up drivers. Once I had a problem with my USB-Hub, so ensure to connect it directly.
You could also try a different/shorter USB cable.
**Switching the HID-Core** might confuse the OS since the USB device changes completely from one second to the other.
Therefore go to Printers and Devices on Windows and select remove. Reconnect your Arduino and maybe remove it again if its not working properly.
Alternatively you can also restart your PC or use another USB PID (in the boards.txt) to see if its a Windows problem or not.
@ -193,7 +213,6 @@ Generalize HID key definitions via HIDTables for example?
update Burning via ISP (advanced)
Test with Android phone (HL1)
"Emulate" HL1 protocol
test no usb function with leonardo (usb workaround?)
remove dev HL2 link
```

View file

@ -0,0 +1,31 @@
/*
Copyright (c) 2014 NicoHood
See the readme for credit to other people.
Leonardo_Micro_NoUSB_Blink
Blinks Led and shows what workaround is needed to fix the timing.
This is not needed for HoodLoader2 devices any more.
*/
// workaround for undefined USBCON has to be placed in every sketch
// otherwise the timings wont work correctly
ISR(USB_GEN_vect)
{
UDINT = 0;
}
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}