summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpldcpu <cpldcpu@gmail.com>2015-07-26 19:41:15 +0200
committercpldcpu <cpldcpu@gmail.com>2015-07-26 19:41:15 +0200
commit39588ecd592c85544cced1961ba6ae875c9695ef (patch)
tree16ddf524e49768ac18069019e4d1c26d6f50f8a5
parent8fd935fa941ba3844818a3b739de26cdbe5892e4 (diff)
downloadmicronucleus-39588ecd592c85544cced1961ba6ae875c9695ef.tar.gz
micronucleus-39588ecd592c85544cced1961ba6ae875c9695ef.tar.bz2
micronucleus-39588ecd592c85544cced1961ba6ae875c9695ef.zip
firmware: Use fast CRC when cpu clock is below 16MHz to fix USB3.0 port timeouts.
-rw-r--r--firmware/usbconfig.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/firmware/usbconfig.h b/firmware/usbconfig.h
index 65864df..7ca31c5 100644
--- a/firmware/usbconfig.h
+++ b/firmware/usbconfig.h
@@ -184,7 +184,18 @@ return;\
/* define this macro to 1 if you want the function usbMeasureFrameLength()
* compiled in. This function can be used to calibrate the AVR's RC oscillator.
*/
-#define USB_USE_FAST_CRC 0
+
+
+#if USB_CFG_CLOCK_KHZ<16000
+ #define USB_USE_FAST_CRC 1
+#else
+ #define USB_USE_FAST_CRC 0
+#endif
+
+/* If the CPU clock is below 16Mhz you have to use the faster CRC routines.
+ * otherwise time outs may occur on USB3.0 ports. This adds 20 bytes.
+ */
+
/* The assembler module has two implementations for the CRC algorithm. One is
* faster, the other is smaller. This CRC routine is only used for transmitted
* messages where timing is not critical. The faster routine needs 31 cycles