• R/O
  • SSH
  • HTTPS

chibios: Commit


Commit MetaInfo

Revision13727 (tree)
Time2020-06-26 16:51:15
Authorgdisirio

Log Message

Added a new setting to STM32 USBv1 allowing for some clock deviation from 48MHz. Renamed setting USB_HOST_WAKEUP_DURATION to STM32_USB_HOST_WAKEUP_DURATION for consistency.

Change Summary

Incremental Difference

--- branches/stable_20.3.x/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.h (revision 13726)
+++ branches/stable_20.3.x/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.h (revision 13727)
@@ -108,10 +108,17 @@
108108 /**
109109 * @brief Host wake-up procedure duration.
110110 */
111-#if !defined(USB_HOST_WAKEUP_DURATION) || defined(__DOXYGEN__)
112-#define USB_HOST_WAKEUP_DURATION 2
111+#if !defined(STM32_USB_HOST_WAKEUP_DURATION) || defined(__DOXYGEN__)
112+#define STM32_USB_HOST_WAKEUP_DURATION 2
113113 #endif
114114
115+/**
116+ * @brief Allowed deviation for the 48MHz clock.
117+ */
118+#if !defined(STM32_USB_48MHZ_DELTA) || defined(__DOXYGEN__)
119+#define STM32_USB_48MHZ_DELTA 0
120+#endif
121+
115122 /*===========================================================================*/
116123 /* Derived constants and error checks. */
117124 /*===========================================================================*/
@@ -135,10 +142,6 @@
135142 #error "Invalid IRQ priority assigned to USB LP"
136143 #endif
137144
138-#if STM32_USBCLK != 48000000
139-#error "the USB driver requires a 48MHz clock"
140-#endif
141-
142145 #if !defined(STM32_USB1_HP_HANDLER)
143146 #error "STM32_USB1_HP_HANDLER not defined"
144147 #endif
@@ -155,10 +158,19 @@
155158 #error "STM32_USB1_LP_NUMBER not defined"
156159 #endif
157160
158-#if (USB_HOST_WAKEUP_DURATION < 2) || (USB_HOST_WAKEUP_DURATION > 15)
159-#error "invalid USB_HOST_WAKEUP_DURATION setting, it must be between 2 and 15"
161+#if (STM32_USB_HOST_WAKEUP_DURATION < 2) || (STM32_USB_HOST_WAKEUP_DURATION > 15)
162+#error "invalid STM32_USB_HOST_WAKEUP_DURATION setting, it must be between 2 and 15"
160163 #endif
161164
165+#if (STM32_USB_48MHZ_DELTA < 0) || (STM32_USB_48MHZ_DELTA > 250000)
166+#error "invalid STM32_USB_48MHZ_DELTA setting, it must not exceed 250000"
167+#endif
168+
169+#if (STM32_USBCLK < (48000000 - STM32_USB_48MHZ_DELTA)) || \
170+ (STM32_USBCLK > (48000000 + STM32_USB_48MHZ_DELTA))
171+#error "the USB driver requires a 48MHz clock"
172+#endif
173+
162174 /*===========================================================================*/
163175 /* Driver data structures and types. */
164176 /*===========================================================================*/
@@ -467,7 +479,7 @@
467479 #define usb_lld_wakeup_host(usbp) \
468480 do { \
469481 STM32_USB->CNTR |= USB_CNTR_RESUME; \
470- osalThreadSleepMilliseconds(USB_HOST_WAKEUP_DURATION); \
482+ osalThreadSleepMilliseconds(STM32_USB_HOST_WAKEUP_DURATION); \
471483 STM32_USB->CNTR &= ~USB_CNTR_RESUME; \
472484 } while (false)
473485
--- branches/stable_20.3.x/readme.txt (revision 13726)
+++ branches/stable_20.3.x/readme.txt (revision 13727)
@@ -74,6 +74,9 @@
7474 *****************************************************************************
7575
7676 *** 20.3.2 ***
77+- NEW: Added a new setting to STM32 USBv1 allowing for some clock deviation
78+ from 48MHz. Renamed setting USB_HOST_WAKEUP_DURATION to
79+ STM32_USB_HOST_WAKEUP_DURATION for consistency.
7780 - FIX: Fixed extra condition in MAC driver macWaitTransmitDescriptor() function
7881 (bug #1106).
7982 - FIX: Fixed schedule anomaly when CH_CFG_TIME_QUANTUM is greater than zero
@@ -93,6 +96,7 @@
9396 - FIX: Fixed STM32G4 demos compile fails if smart mode is disabled (bug #1094).
9497 - FIX: Fixed failure in chSemReset() function when counter is equal to MAXINT
9598 (bug #1093).
99+- FIX: Fixed error in EXTIv1 ISRs (bug #1077).
96100
97101 *** 20.3.1 ***
98102 - NEW: STM32 ICU driver now allows to setup the ARR register in the
@@ -116,6 +120,5 @@
116120 - FIX: Fixed I2CD4 interrupt vectors are swapped versus I2CD1-I2CD3 (bug #1080).
117121 - FIX: Fixed incorrect clock check when using PLLSAI1R in ADCv3 (bug #1079).
118122 - FIX: Fixed missing checks in TIM6 and TIM7 STM32 mini drivers (bug #1078).
119-- FIX: Fixed error in EXTIv1 ISRs (bug #1077).
120123 - FIX: Fixed problem in chMtxUnlockAllS() (bug #1076).
121124
Show on old repository browser