From 4563713e5b4b952d44d744559bffae13e8d207da Mon Sep 17 00:00:00 2001 From: Nico Date: Sat, 27 Dec 2014 18:38:01 +0100 Subject: [PATCH] Resolved minor TODOs --- Readme.md | 52 +++++-------------- avr/boards.txt | 4 +- .../Atmega_Board_Programmer.ino | 11 ++-- 3 files changed, 21 insertions(+), 46 deletions(-) diff --git a/Readme.md b/Readme.md index b5cbc46..59d2169 100644 --- a/Readme.md +++ b/Readme.md @@ -37,10 +37,10 @@ and some online shops even sell the bigger 32u2 (I've got two of them :D). * Arduino IDE integration + programming with the 16u2 (USB-Core) * IDE example sketches for HID devices (Mouse, Keyboard, Gamepad, Media/System Keys) * IDE example sketch for a working Serial + Keyboard demonstration -* IDE example sketch for no usb usage * IDE example sketch for PWM demonstration * IDE example USB-Serial demo (equal to original firmware for baud rate 115200) * IDE example sketch for 16u2 - 328/2560 communication (HoodLoader1 technique) +* Newer features are listed in the HID Project page itself. **16u2 features on a normal Uno/Mega R3:** * 16kb flash (minus 4kb for the HoodLoader2) (8 for a 8u2, 32 for a 32u2) @@ -161,11 +161,11 @@ lock_bits=0x2F Official DFU + USB-Serial Fuses: -low_fuses=0xFF // Nick Gammon read 0xEF, have to check this +low_fuses=0xEF high_fuses=0xD9 extended_fuses=0xF4 unlock_bits=0x3F -lock_bits=0x2F +lock_bits=0xCF ``` ### Updating HoodLoader2 to a newer version @@ -250,18 +250,8 @@ Have a look at the examples in the HID Project and check out the [pinout](https: 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. -You have to add an ISR into every sketch then. Checkout the 'HoodLoader2_NoUSB_Blink' example in the HID Project. - -```cpp -#ifndef USBCON -// workaround for undefined USBCON has to be placed in every sketch -// otherwise the timings wont work correctly -ISR(USB_GEN_vect) -{ - UDINT = 0; -} -#endif -``` + +**No workaround is no longer needed with version 2.0.1 or newer.** ### How to flash/erase firmwares (.hex files) with avr-dude @@ -362,32 +352,15 @@ Baud 57600 cannot be used in bootloader mode since its used for CDC programming. The main MCU will always reset on a 16u2 reprogramming. There is no way to fix this (yet). -Gamepads and RAW-HID in an HID multi report gives problems under some OS (Gamepads especially Linux). -This is an OS bug and has nothing to do with the HoodLoader. - -Also the HoodLoader only ensures that you can upload sketches to the MCUs. If your USB HID devices have any problems -please check the HID Project for known bugs/updates. - -TODO -==== -(ignore this, its just for me) - -documentation HoodLoader2: -pictures, example with leds spi, ir sensor, usb function -check if fastled/other libs work - -Bootloader itself: -remove buffer and use endpoint double banks? store prev endpoint state in isr! (reliable and useful??) -change bootloader key position in ram? - -check fuse setting: 0xEF, vs 0xFF -fix usb vid pass via boards.txt +The HoodLoader only ensures that you can upload sketches to the MCUs. +If your USB HID device causes any problem please check the HID Project for known bugs/updates. -Hid Project: -update Burning via ISP (advanced) -system wakeup and other (github pull requests) -Test with Android phone +The Magic BootKey is not stored properly in ram and may cause errors. This is a general Arduino +Software problem, we have to do this to keep compatible. Normally there shouldn't be any noticeable error. +This bug has a workaround in the HID Project so it wont matter any ways. Just want to mention it here. +The USB setting (pid, vid, manufacturer, name) cannot be passed with the new IDE because the u2 Series is not integrated. +These values are defined in the pins_arduino.h Version History =============== @@ -401,6 +374,7 @@ Version History 2.0.1 Pre-Release (29.11.2014) * HoodLoader2.0.1 Release * Better, full reset after bootloader execution with watchdog + * This fixes the "No-USB" workaround with the USB clock * Fixed fuse bug * Fixed magic key passed from Arduino core (HID Project) * Changed some descriptor names, bugfix above freed some space diff --git a/avr/boards.txt b/avr/boards.txt index 38012a9..e60a26c 100644 --- a/avr/boards.txt +++ b/avr/boards.txt @@ -237,11 +237,11 @@ HoodLoader2atmega16u2DFU.upload.tool=arduino:avrdude HoodLoader2atmega16u2DFU.build.mcu=atmega16u2 #fuses (HoodLoader2 only, not suitable for DFU) -HoodLoader2atmega16u2DFU.bootloader.low_fuses=0xFF +HoodLoader2atmega16u2DFU.bootloader.low_fuses=0xEF HoodLoader2atmega16u2DFU.bootloader.high_fuses=0xD9 HoodLoader2atmega16u2DFU.bootloader.extended_fuses=0xF4 HoodLoader2atmega16u2DFU.bootloader.unlock_bits=0x3F -HoodLoader2atmega16u2DFU.bootloader.lock_bits=0x0F +HoodLoader2atmega16u2DFU.bootloader.lock_bits=0xCF #Board selection (only important for burning bootloaders) diff --git a/tools/Atmega_Board_Programmer/Atmega_Board_Programmer.ino b/tools/Atmega_Board_Programmer/Atmega_Board_Programmer.ino index 83b6856..aea1f47 100644 --- a/tools/Atmega_Board_Programmer/Atmega_Board_Programmer.ino +++ b/tools/Atmega_Board_Programmer/Atmega_Board_Programmer.ino @@ -54,8 +54,9 @@ along with Hoodloader2. If not, see . // Version 1.26-A: Turn off programming mode when done (so chip can run) // Version 1.26-B: Updated to HoodLoader 2.0.1 // Version 1.26-C: Updated to HoodLoader 2.0.2 +// Version 1.26-D: Corrected Fuses to original Arduino values -#define VERSION "1.26-C" +#define VERSION "1.26-D" //================================================================================ // HoodLoader2 definitions @@ -216,10 +217,10 @@ signatureType signatures [] = 0x0000, // start address (0x0000-0x4000) sizeof Arduino_COMBINED_dfu_usbserial_atmega16u2_Mega2560_Rev3_hex, 128, // page size in bytes (for committing) - 0xFF, // fuse low byte: external clock, m + 0xEF, // fuse low byte: external clock, m 0xD9, // fuse high byte: SPI enable, NOT boot into bootloader, 4096 byte bootloader 0xF4, // fuse extended byte: brown-out detection at 2.6V - 0x0F }, // lock bits + 0xCF }, // lock bits #else // HOODLOADER2_16U2_UNO { { 0x1E, 0x94, 0x89 }, "ATmega16U2", 16 * kb, 512 , @@ -227,10 +228,10 @@ signatureType signatures [] = 0x0000, // start address (0x0000-0x4000) sizeof Arduino_COMBINED_dfu_usbserial_atmega16u2_Uno_Rev3_hex, 128, // page size in bytes (for committing) - 0xFF, // fuse low byte: external clock, m + 0xEF, // fuse low byte: external clock, m 0xD9, // fuse high byte: SPI enable, NOT boot into bootloader, 4096 byte bootloader 0xF4, // fuse extended byte: brown-out detection at 2.6V - 0x0F }, // lock bits + 0xCF }, // lock bits #endif