Rev 3332 Rev 3333
1 This file documents changes in the firmware-only USB driver for atmel's AVR 1 This file documents changes in the firmware-only USB driver for atmel's AVR
2 microcontrollers. New entries are always appended to the end of the file. 2 microcontrollers. New entries are always appended to the end of the file.
3 Scroll down to the bottom to see the most recent changes. 3 Scroll down to the bottom to see the most recent changes.
4   4  
5 2005-04-01: 5 2005-04-01:
6 - Implemented endpoint 1 as interrupt-in endpoint. 6 - Implemented endpoint 1 as interrupt-in endpoint.
7 - Moved all configuration options to usbconfig.h which is not part of the 7 - Moved all configuration options to usbconfig.h which is not part of the
8 driver. 8 driver.
9 - Changed interface for usbVendorSetup(). 9 - Changed interface for usbVendorSetup().
10 - Fixed compatibility with ATMega8 device. 10 - Fixed compatibility with ATMega8 device.
11 - Various minor optimizations. 11 - Various minor optimizations.
12   12  
13 2005-04-11: 13 2005-04-11:
14 - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead() 14 - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead()
15 and usbFunctionWrite() now. Added configuration options to choose which 15 and usbFunctionWrite() now. Added configuration options to choose which
16 of these functions to compile in. 16 of these functions to compile in.
17 - Assembler module delivers receive data non-inverted now. 17 - Assembler module delivers receive data non-inverted now.
18 - Made register and bit names compatible with more AVR devices. 18 - Made register and bit names compatible with more AVR devices.
19   19  
20 2005-05-03: 20 2005-05-03:
21 - Allow address of usbRxBuf on any memory page as long as the buffer does 21 - Allow address of usbRxBuf on any memory page as long as the buffer does
22 not cross 256 byte page boundaries. 22 not cross 256 byte page boundaries.
23 - Better device compatibility: works with Mega88 now. 23 - Better device compatibility: works with Mega88 now.
24 - Code optimization in debugging module. 24 - Code optimization in debugging module.
25 - Documentation updates. 25 - Documentation updates.
26   26  
27 2006-01-02: 27 2006-01-02:
28 - Added (free) default Vendor- and Product-IDs bought from voti.nl. 28 - Added (free) default Vendor- and Product-IDs bought from voti.nl.
29 - Added USBID-License.txt file which defines the rules for using the free 29 - Added USBID-License.txt file which defines the rules for using the free
30 shared VID/PID pair. 30 shared VID/PID pair.
31 - Added Readme.txt to the usbdrv directory which clarifies administrative 31 - Added Readme.txt to the usbdrv directory which clarifies administrative
32 issues. 32 issues.
33   33  
34 2006-01-25: 34 2006-01-25:
35 - Added "configured state" to become more standards compliant. 35 - Added "configured state" to become more standards compliant.
36 - Added "HALT" state for interrupt endpoint. 36 - Added "HALT" state for interrupt endpoint.
37 - Driver passes the "USB Command Verifier" test from usb.org now. 37 - Driver passes the "USB Command Verifier" test from usb.org now.
38 - Made "serial number" a configuration option. 38 - Made "serial number" a configuration option.
39 - Minor optimizations, we now recommend compiler option "-Os" for best 39 - Minor optimizations, we now recommend compiler option "-Os" for best
40 results. 40 results.
41 - Added a version number to usbdrv.h 41 - Added a version number to usbdrv.h
42   42  
43 2006-02-03: 43 2006-02-03:
44 - New configuration variable USB_BUFFER_SECTION for the memory section where 44 - New configuration variable USB_BUFFER_SECTION for the memory section where
45 the USB rx buffer will go. This defaults to ".bss" if not defined. Since 45 the USB rx buffer will go. This defaults to ".bss" if not defined. Since
46 this buffer MUST NOT cross 256 byte pages (not even touch a page at the 46 this buffer MUST NOT cross 256 byte pages (not even touch a page at the
47 end), the user may want to pass a linker option similar to 47 end), the user may want to pass a linker option similar to
48 "-Wl,--section-start=.mybuffer=0x800060". 48 "-Wl,--section-start=.mybuffer=0x800060".
49 - Provide structure for usbRequest_t. 49 - Provide structure for usbRequest_t.
50 - New defines for USB constants. 50 - New defines for USB constants.
51 - Prepared for HID implementations. 51 - Prepared for HID implementations.
52 - Increased data size limit for interrupt transfers to 8 bytes. 52 - Increased data size limit for interrupt transfers to 8 bytes.
53 - New macro usbInterruptIsReady() to query interrupt buffer state. 53 - New macro usbInterruptIsReady() to query interrupt buffer state.
54   54  
55 2006-02-18: 55 2006-02-18:
56 - Ensure that the data token which is sent as an ack to an OUT transfer is 56 - Ensure that the data token which is sent as an ack to an OUT transfer is
57 always zero sized. This fixes a bug where the host reports an error after 57 always zero sized. This fixes a bug where the host reports an error after
58 sending an out transfer to the device, although all data arrived at the 58 sending an out transfer to the device, although all data arrived at the
59 device. 59 device.
60 - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite(). 60 - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite().
61   61  
62 * Release 2006-02-20 62 * Release 2006-02-20
63   63  
64 - Give a compiler warning when compiling with debugging turned on. 64 - Give a compiler warning when compiling with debugging turned on.
65 - Added Oleg Semyonov's changes for IAR-cc compatibility. 65 - Added Oleg Semyonov's changes for IAR-cc compatibility.
66 - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect() 66 - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect()
67 (also thanks to Oleg!). 67 (also thanks to Oleg!).
68 - Rearranged tests in usbPoll() to save a couple of instructions in the most 68 - Rearranged tests in usbPoll() to save a couple of instructions in the most
69 likely case that no actions are pending. 69 likely case that no actions are pending.
70 - We need a delay between the SET ADDRESS request until the new address 70 - We need a delay between the SET ADDRESS request until the new address
71 becomes active. This delay was handled in usbPoll() until now. Since the 71 becomes active. This delay was handled in usbPoll() until now. Since the
72 spec says that the delay must not exceed 2ms, previous versions required 72 spec says that the delay must not exceed 2ms, previous versions required
73 aggressive polling during the enumeration phase. We have now moved the 73 aggressive polling during the enumeration phase. We have now moved the
74 handling of the delay into the interrupt routine. 74 handling of the delay into the interrupt routine.
75 - We must not reply with NAK to a SETUP transaction. We can only achieve this 75 - We must not reply with NAK to a SETUP transaction. We can only achieve this
76 by making sure that the rx buffer is empty when SETUP tokens are expected. 76 by making sure that the rx buffer is empty when SETUP tokens are expected.
77 We therefore don't pass zero sized data packets from the status phase of 77 We therefore don't pass zero sized data packets from the status phase of
78 a transfer to usbPoll(). This change MAY cause troubles if you rely on 78 a transfer to usbPoll(). This change MAY cause troubles if you rely on
79 receiving a less than 8 bytes long packet in usbFunctionWrite() to 79 receiving a less than 8 bytes long packet in usbFunctionWrite() to
80 identify the end of a transfer. usbFunctionWrite() will NEVER be called 80 identify the end of a transfer. usbFunctionWrite() will NEVER be called
81 with a zero length. 81 with a zero length.
82   82  
83 * Release 2006-03-14 83 * Release 2006-03-14
84   84  
85 - Improved IAR C support: tiny memory model, more devices 85 - Improved IAR C support: tiny memory model, more devices
86 - Added template usbconfig.h file under the name usbconfig-prototype.h 86 - Added template usbconfig.h file under the name usbconfig-prototype.h
87   87  
88 * Release 2006-03-26 88 * Release 2006-03-26
89   89  
90 - Added provision for one more interrupt-in endpoint (endpoint 3). 90 - Added provision for one more interrupt-in endpoint (endpoint 3).
91 - Added provision for one interrupt-out endpoint (endpoint 1). 91 - Added provision for one interrupt-out endpoint (endpoint 1).
92 - Added flowcontrol macros for USB. 92 - Added flowcontrol macros for USB.
93 - Added provision for custom configuration descriptor. 93 - Added provision for custom configuration descriptor.
94 - Allow ANY two port bits for D+ and D-. 94 - Allow ANY two port bits for D+ and D-.
95 - Merged (optional) receive endpoint number into global usbRxToken variable. 95 - Merged (optional) receive endpoint number into global usbRxToken variable.
96 - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the 96 - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the
97 variable name from the single port letter instead of computing the address 97 variable name from the single port letter instead of computing the address
98 of related ports from the output-port address. 98 of related ports from the output-port address.
99   99  
100 * Release 2006-06-26 100 * Release 2006-06-26
101   101  
102 - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the 102 - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the
103 new features. 103 new features.
104 - Removed "#warning" directives because IAR does not understand them. Use 104 - Removed "#warning" directives because IAR does not understand them. Use
105 unused static variables instead to generate a warning. 105 unused static variables instead to generate a warning.
106 - Do not include <avr/io.h> when compiling with IAR. 106 - Do not include <avr/io.h> when compiling with IAR.
107 - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each 107 - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each
108 USB descriptor should be handled. It is now possible to provide descriptor 108 USB descriptor should be handled. It is now possible to provide descriptor
109 data in Flash, RAM or dynamically at runtime. 109 data in Flash, RAM or dynamically at runtime.
110 - STALL is now a status in usbTxLen* instead of a message. We can now conform 110 - STALL is now a status in usbTxLen* instead of a message. We can now conform
111 to the spec and leave the stall status pending until it is cleared. 111 to the spec and leave the stall status pending until it is cleared.
112 - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the 112 - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the
113 application code to reset data toggling on interrupt pipes. 113 application code to reset data toggling on interrupt pipes.
114   114  
115 * Release 2006-07-18 115 * Release 2006-07-18
116   116  
117 - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes 117 - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes
118 an assembler error. 118 an assembler error.
119 - usbDeviceDisconnect() takes pull-up resistor to high impedance now. 119 - usbDeviceDisconnect() takes pull-up resistor to high impedance now.
120   120  
121 * Release 2007-02-01 121 * Release 2007-02-01
122   122  
123 - Merged in some code size improvements from usbtiny (thanks to Dick 123 - Merged in some code size improvements from usbtiny (thanks to Dick
124 Streefland for these optimizations!) 124 Streefland for these optimizations!)
125 - Special alignment requirement for usbRxBuf not required any more. Thanks 125 - Special alignment requirement for usbRxBuf not required any more. Thanks
126 again to Dick Streefland for this hint! 126 again to Dick Streefland for this hint!
127 - Reverted to "#warning" instead of unused static variables -- new versions 127 - Reverted to "#warning" instead of unused static variables -- new versions
128 of IAR CC should handle this directive. 128 of IAR CC should handle this directive.
129 - Changed Open Source license to GNU GPL v2 in order to make linking against 129 - Changed Open Source license to GNU GPL v2 in order to make linking against
130 other free libraries easier. We no longer require publication of the 130 other free libraries easier. We no longer require publication of the
131 circuit diagrams, but we STRONGLY encourage it. If you improve the driver 131 circuit diagrams, but we STRONGLY encourage it. If you improve the driver
132 itself, PLEASE grant us a royalty free license to your changes for our 132 itself, PLEASE grant us a royalty free license to your changes for our
133 commercial license. 133 commercial license.
134   134  
-   135 * Release 2007-03-29
-   136  
-   137 - New configuration option "USB_PUBLIC" in usbconfig.h.
-   138 - Set USB version number to 1.10 instead of 1.01.
-   139 - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and
-   140 USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences
-   141 to USB_CFG_DESCR_PROPS_STRING_PRODUCT.
-   142 - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver
-   143 code.
-   144 - New assembler module for 16 MHz crystal.
-   145 - usbdrvasm.S contains common code only, clock-specific parts have been moved
-   146 to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively.
-   147  
-   148 * Release 2007-06-25
-   149  
-   150 - 16 MHz module: Do SE0 check in stuffed bits as well.
-   151  
-   152 * Release 2007-07-07
-   153  
-   154 - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary
-   155 for negative values.
-   156 - Added 15 MHz module contributed by V. Bosch.
-   157 - Interrupt vector name can now be configured. This is useful if somebody
-   158 wants to use a different hardware interrupt than INT0.
-   159  
-   160 * Release 2007-08-07
-   161  
-   162 - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is
-   163 not exceeded.
-   164 - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN,
-   165 USB_COUNT_SOF
-   166 - USB_INTR_PENDING can now be a memory address, not just I/O
-   167  
-   168 * Release 2007-09-19
-   169  
-   170 - Split out common parts of assembler modules into separate include file
-   171 - Made endpoint numbers configurable so that given interface definitions
-   172 can be matched. See USB_CFG_EP3_NUMBER in usbconfig-prototype.h.
-   173 - Store endpoint number for interrupt/bulk-out so that usbFunctionWriteOut()
-   174 can handle any number of endpoints.
-   175 - Define usbDeviceConnect() and usbDeviceDisconnect() even if no
-   176 USB_CFG_PULLUP_IOPORTNAME is defined. Directly set D+ and D- to 0 in this
-   177 case.
-   178  
-   179 * Release 2007-12-01
-   180  
-   181 - Optimize usbDeviceConnect() and usbDeviceDisconnect() for less code size
-   182 when USB_CFG_PULLUP_IOPORTNAME is not defined.
-   183  
-   184 * Release 2007-12-13
-   185  
-   186 - Renamed all include-only assembler modules from *.S to *.inc so that
-   187 people don't add them to their project sources.
-   188 - Distribute leap bits in tx loop more evenly for 16 MHz module.
-   189 - Use "macro" and "endm" instead of ".macro" and ".endm" for IAR
-   190 - Avoid compiler warnings for constant expr range by casting some values in
-   191 USB descriptors.
-   192  
-   193 * Release 2008-01-21
-   194  
-   195 - Fixed bug in 15 and 16 MHz module where the new address set with
-   196 SET_ADDRESS was already accepted at the next NAK or ACK we send, not at
-   197 the next data packet we send. This caused problems when the host polled
-   198 too fast. Thanks to Alexander Neumann for his help and patience debugging
-   199 this issue!
-   200  
-   201 * Release 2008-02-05
-   202  
-   203 - Fixed bug in 16.5 MHz module where a register was used in the interrupt
-   204 handler before it was pushed. This bug was introduced with version
-   205 2007-09-19 when common parts were moved to a separate file.
-   206 - Optimized CRC routine (thanks to Reimar Doeffinger).
-   207  
-   208 * Release 2008-02-16
-   209  
-   210 - Removed outdated IAR compatibility stuff (code sections).
-   211 - Added hook macros for USB_RESET_HOOK() and USB_SET_ADDRESS_HOOK().
-   212 - Added optional routine usbMeasureFrameLength() for calibration of the
-   213 internal RC oscillator.
-   214  
-   215 * Release 2008-02-28
-   216  
-   217 - USB_INITIAL_DATATOKEN defaults to USBPID_DATA1 now, which means that we
-   218 start with sending USBPID_DATA0.
-   219 - Changed defaults in usbconfig-prototype.h
-   220 - Added free USB VID/PID pair for MIDI class devices
-   221 - Restructured AVR-USB as separate package, not part of PowerSwitch any more.
-   222  
-   223 * Release 2008-04-18
-   224  
-   225 - Restructured usbdrv.c so that it is easier to read and understand.
-   226 - Better code optimization with gcc 4.
-   227 - If a second interrupt in endpoint is enabled, also add it to config
-   228 descriptor.
-   229 - Added config option for long transfers (above 254 bytes), see
-   230 USB_CFG_LONG_TRANSFERS in usbconfig.h.
-   231 - Added 20 MHz module contributed by Jeroen Benschop.
-   232  
-   233 * Release 2008-05-13
-   234  
-   235 - Fixed bug in libs-host/hiddata.c function usbhidGetReport(): length
-   236 was not incremented, pointer to length was incremented instead.
-   237 - Added code to command line tool(s) which claims an interface. This code
-   238 is disabled by default, but may be necessary on newer Linux kernels.
-   239 - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING".
-   240 - New header "usbportability.h" prepares ports to other development
-   241 environments.
-   242 - Long transfers (above 254 bytes) did not work when usbFunctionRead() was
-   243 used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!]
-   244 - In hiddata.c (example code for sending/receiving data over HID), use
-   245 USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so
-   246 that we need not claim the interface.
-   247 - in usbPoll() loop 20 times polling for RESET state instead of 10 times.
-   248 This accounts for the higher clock rates we now support.
-   249 - Added a module for 12.8 MHz RC oscillator with PLL in receiver loop.
-   250 - Added hook to SOF code so that oscillator can be tuned to USB frame clock.
-   251 - Added timeout to waitForJ loop. Helps preventing unexpected hangs.
-   252 - Added example code for oscillator tuning to libs-device (thanks to
-   253 Henrik Haftmann for the idea to this routine).
-   254 - Implemented option USB_CFG_SUPPRESS_INTR_CODE.
-   255  
-   256 * Release 2008-10-22
-   257  
-   258 - Fixed libs-device/osctune.h: OSCCAL is memory address on ATMega88 and
-   259 similar, not offset of 0x20 needs to be added.
-   260 - Allow distribution under GPLv3 for those who have to link against other
-   261 code distributed under GPLv3.
-   262  
-   263 * Release 2008-11-26
-   264  
-   265 - Removed libusb-win32 dependency for hid-data example in Makefile.windows.
-   266 It was never required and confused many people.
-   267 - Added extern uchar usbRxToken to usbdrv.h.
-   268 - Integrated a module with CRC checks at 18 MHz by Lukas Schrittwieser.
-   269  
-   270 * Release 2009-03-23
-   271  
-   272 - Hid-mouse example used settings from hid-data example, fixed that.
-   273 - Renamed project to V-USB due to a trademark issue with Atmel(r).
-   274 - Changed CommercialLicense.txt and USBID-License.txt to make the
-   275 background of USB ID registration clearer.
-   276  
-   277 * Release 2009-04-15
-   278  
-   279 - Changed CommercialLicense.txt to reflect the new range of PIDs from
-   280 Jason Kotzin.
-   281 - Removed USBID-License.txt in favor of USB-IDs-for-free.txt and
-   282 USB-ID-FAQ.txt
-   283 - Fixed a bug in the 12.8 MHz module: End Of Packet decection was made in
-   284 the center between bit 0 and 1 of each byte. This is where the data lines
-   285 are expected to change and the sampled data may therefore be nonsense.
-   286 We therefore check EOP ONLY if bits 0 AND 1 have both been read as 0 on D-.
-   287 - Fixed a bitstuffing problem in the 16 MHz module: If bit 6 was stuffed,
-   288 the unstuffing code in the receiver routine was 1 cycle too long. If
-   289 multiple bytes had the unstuffing in bit 6, the error summed up until the
-   290 receiver was out of sync.
-   291 - Included option for faster CRC routine.
-   292 Thanks to Slawomir Fras (BoskiDialer) for this code!
-   293 - Updated bits in Configuration Descriptor's bmAttributes according to
-   294 USB 1.1 (in particular bit 7, it is a must-be-set bit now).
-   295  
-   296 * Release 2009-08-22
-   297  
-   298 - Moved first DBG1() after odDebugInit() in all examples.
-   299 - Use vector INT0_vect instead of SIG_INTERRUPT0 if defined. This makes
-   300 V-USB compatible with the new "p" suffix devices (e.g. ATMega328p).
-   301 - USB_CFG_CLOCK_KHZ setting is now required in usbconfig.h (no default any
-   302 more).
-   303 - New option USB_CFG_DRIVER_FLASH_PAGE allows boot loaders on devices with
-   304 more than 64 kB flash.
-   305 - Built-in configuration descriptor allows custom definition for second
-   306 endpoint now.
-   307  
-   308 * Release 2010-07-15
-   309  
-   310 - Fixed bug in usbDriverSetup() which prevented descriptor sizes above 255
-   311 bytes.
-   312 - Avoid a compiler warning for unused parameter in usbHandleResetHook() when
-   313 compiler option -Wextra is enabled.
-   314 - Fixed wrong hex value for some IDs in USB-IDs-for-free.txt.
-   315 - Keep a define for USBATTR_BUSPOWER, although the flag does not exist
-   316 in USB 1.1 any more. Set it to 0. This is for backward compatibility.
-   317  
-   318 * Release 2012-01-09
-   319  
-   320 - Define a separate (defined) type for usbMsgPtr so that projects using a
-   321 tiny memory model can define it to an 8 bit type in usbconfig.h. This
-   322 change also saves a couple of bytes when using a scalar 16 bit type.
-   323 - Inserted "const" keyword for all PROGMEM declarations because new GCC
-   324 requires it.
-   325 - Fixed problem with dependence of usbportability.h on usbconfig.h. This
-   326 problem occurred with IAR CC only.
-   327 - Prepared repository for github.com.
-   328  
-   329 * Release 2012-12-06
135 330