USB device stack with Nucleo F401RE support. NOTE: the default clock config needs to be changed to in order for USB to work.
Fork of USBDevice by
Slightly modified original USBDevice library to support F401RE.
On F401RE the data pins of your USB connector should be attached to PA12 (D+) and PA11(D-). It is also required to connect the +5V USB line to PA9.
F401RE requires 48MHz clock for USB. Therefore in order for this to work you will need to change the default clock settings:
Clock settings for USB
#include "stm32f4xx_hal.h" RCC_OscInitTypeDef RCC_OscInitStruct; RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = 16; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; RCC_OscInitStruct.PLL.PLLM = 16; RCC_OscInitStruct.PLL.PLLN = 336; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; RCC_OscInitStruct.PLL.PLLQ = 7; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { error("RTC error: LSI clock initialization failed."); }
NOTE: Changing the clock frequency might affect the behavior of other libraries. I only tested the Serial library.
UPDATE: Clock settings should not to be changed anymore! Looks like the newer mbed library has the required clock enabled.
Revisions of USBDevice/USBDevice.cpp
Revision | Date | Message | Actions |
---|---|---|---|
18:78bdbce94509 | 2014-02-18 | Synchronized with git revision 3c8f1c0c59bc1b665e9e1b1b3dc00e5fcdde6400 | File Diff Annotate |
17:bbd6dac92961 | 2014-01-23 | Synchronized with git revision b7a925e3cf046d2c5a95f80b14d6c285afbdfa7e | File Diff Annotate |
11:eeb3cbbaa996 | 2013-08-05 | Bug fixes, added suppor for LPC1347 | File Diff Annotate |
8:335f2506f422 | 2013-03-01 | add FRDM-KL25Z support | File Diff Annotate |
1:80ab0d068708 | 2012-07-17 | Update USBDevice lib | File Diff Annotate |