From 94d65d718aa737d8acc51c1cdb3bfbbde1fd3255 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 20 Jul 2016 10:22:24 +0200 Subject: ucoo/hal/usb: workaround for F479 --- ucoo/hal/usb/usb.stm32.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ucoo') diff --git a/ucoo/hal/usb/usb.stm32.cc b/ucoo/hal/usb/usb.stm32.cc index e37d25b..5ed6b27 100644 --- a/ucoo/hal/usb/usb.stm32.cc +++ b/ucoo/hal/usb/usb.stm32.cc @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include "usb_desc.stm32.h" @@ -157,6 +159,21 @@ UsbStreamControl::enable () usbdev = usbd_init (&usb_driver, &usb_desc_dev, &usb_desc_config, strings, lengthof (strings), usb_control_buffer, sizeof (usb_control_buffer)); +#if CONFIG_UCOO_HAL_USB_DRIVER_HS + if (OTG_HS_CID == 0x2000) + { + // Different registers in F479. + OTG_HS_GCCFG = (1 << 21) | (1 << 16); + OTG_HS_DCTL = 0; + } +#else + if (OTG_FS_CID == 0x2000) + { + // Different registers in F479. + OTG_FS_GCCFG = (1 << 21) | (1 << 16); + OTG_FS_DCTL = 0; + } +#endif usbd_register_set_config_callback (usbdev, set_config); #if CONFIG_UCOO_HAL_USB_DRIVER_HS nvic_enable_irq (NVIC_OTG_HS_IRQ); -- cgit v1.2.3