aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-04-15 08:57:50 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-04-15 08:57:50 +0000
commit8097785b8a1d668944747bc02431451664669986 (patch)
tree9000b03a076d82b8ad89a3ba7c481532fd3a368f
parent2cdfb90a17502fc70bb243da96e94c738ffe6fea (diff)
downloadChibiOS-8097785b8a1d668944747bc02431451664669986.tar.gz
ChibiOS-8097785b8a1d668944747bc02431451664669986.tar.bz2
ChibiOS-8097785b8a1d668944747bc02431451664669986.zip
Fixed bug #938 and #939.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11940 110e8d01-0319-4d1e-a829-52ad28d1bb01
-rw-r--r--os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.c9
-rw-r--r--os/hal/src/hal_usb.c5
-rw-r--r--readme.txt4
3 files changed, 17 insertions, 1 deletions
diff --git a/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.c b/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.c
index 1abbbf747..e773bc143 100644
--- a/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.c
+++ b/os/hal/ports/STM32/LLD/USBv1/hal_usb_lld.c
@@ -647,6 +647,15 @@ void usb_lld_init_endpoint(USBDriver *usbp, usbep_t ep) {
#endif
}
+ /* Resetting the data toggling bits for this endpoint.*/
+ if (STM32_USB->EPR[ep] & EPR_DTOG_RX) {
+ epr |= EPR_DTOG_RX;
+ }
+
+ if (STM32_USB->EPR[ep] & EPR_DTOG_TX) {
+ epr |= EPR_DTOG_TX;
+ }
+
/* EPxR register setup.*/
EPR_SET(ep, epr | ep);
EPR_TOGGLE(ep, epr);
diff --git a/os/hal/src/hal_usb.c b/os/hal/src/hal_usb.c
index d264a2ac3..eedc541c2 100644
--- a/os/hal/src/hal_usb.c
+++ b/os/hal/src/hal_usb.c
@@ -142,9 +142,12 @@ static bool default_handler(USBDriver *usbp) {
usbSetupTransfer(usbp, &usbp->configuration, 1, NULL);
return true;
case (uint32_t)USB_RTYPE_RECIPIENT_DEVICE | ((uint32_t)USB_REQ_SET_CONFIGURATION << 8):
+#if defined(USB_SET_CONFIGURATION_OLD_BEHAVIOR)
/* Handling configuration selection from the host only if it is different
from the current configuration.*/
- if (usbp->configuration != usbp->setup[2]) {
+ if (usbp->configuration != usbp->setup[2])
+#endif
+ {
/* If the USB device is already active then we have to perform the clear
procedure on the current configuration.*/
if (usbp->state == USB_ACTIVE) {
diff --git a/readme.txt b/readme.txt
index df9800e90..71966e7a3 100644
--- a/readme.txt
+++ b/readme.txt
@@ -111,6 +111,10 @@
- EX: Updated LIS302DL to 1.1.0 (backported to 18.2.1).
- EX: Updated LPS25H to 1.1.0 (backported to 18.2.1).
- EX: Updated LSM303DLHC to 1.1.0 (backported to 18.2.1).
+- HAL: Fixed STM32 USBv1 driver does not reset data toggling bits on endpoint
+ initialization (bug #939)(TO BE backported to 18.2.1 and 17.6.5).
+-- HAL: Fixed incorrect behavior of USB driver on SET CONFIGURATION (bug #938)
+ (TO BE backported to 18.2.1 and 17.6.5).
- HAL: Fixed macro expansion problem in SPI high level driver (bug #937)
(backported to 18.2.1).
- HAL: Fixed missing CAN2 macros from STM32L4xx stm32_rcc.h file (bug #936)