diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-02-14 19:45:28 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2011-02-14 19:45:28 +0000 |
commit | 20a4b38126be234c5f946df9254c7d64502ff855 (patch) | |
tree | a2687810152b88b7e593f0f1d06910b11f125472 | |
parent | 2c15c4864f33c3c71c58e54494561eff1b291a0f (diff) | |
download | ChibiOS-20a4b38126be234c5f946df9254c7d64502ff855.tar.gz ChibiOS-20a4b38126be234c5f946df9254c7d64502ff855.tar.bz2 ChibiOS-20a4b38126be234c5f946df9254c7d64502ff855.zip |
STM32 USB reset done right.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2739 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r-- | os/hal/platforms/STM32/usb_lld.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/os/hal/platforms/STM32/usb_lld.c b/os/hal/platforms/STM32/usb_lld.c index 5125f1cee..0a7bc9315 100644 --- a/os/hal/platforms/STM32/usb_lld.c +++ b/os/hal/platforms/STM32/usb_lld.c @@ -319,7 +319,8 @@ void usb_lld_start(USBDriver *usbp) { CORTEX_PRIORITY_MASK(STM32_USB_USB1_HP_IRQ_PRIORITY));
NVICEnableVector(USB_LP_CAN1_RX0_IRQn,
CORTEX_PRIORITY_MASK(STM32_USB_USB1_LP_IRQ_PRIORITY));
-
+ /* Releases the USB reset.*/
+ STM32_USB->CNTR = 0;
}
#endif
/* Reset procedure enforced on driver start.*/
@@ -360,11 +361,8 @@ void usb_lld_stop(USBDriver *usbp) { void usb_lld_reset(USBDriver *usbp) {
uint32_t cntr;
- /* Powers up the transceiver while holding the USB in reset state.*/
- STM32_USB->CNTR = CNTR_FRES;
-
- /* Releases the USB reset, BTABLE is reset to zero.*/
- STM32_USB->CNTR = 0;
+ /* Post reset initialization.*/
+ STM32_USB->BTABLE = 0;
STM32_USB->ISTR = 0;
STM32_USB->DADDR = DADDR_EF;
cntr = /*CNTR_ESOFM | */ CNTR_RESETM | /*CNTR_SUSPM |*/
|