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 Tomas Cerskus

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.

Changes

RevisionDateWhoCommit message
24:4ed3e25c3edc 2014-03-30 tolaipner Added Nucleo F401RE support default tip
23:ee5d634d099e 2014-03-30 tolaipner Nucleo F401RE support
22:a4b9c279b437 2014-03-30 tolaipner Nucleo F401RE support
21:ee9f2fa6bdbc 2014-03-27 mbed_official Synchronized with git revision 3d49a491d4dd16466354746d3c329428840f5a03
20:d38b72fed893 2014-02-27 mbed_official Synchronized with git revision 6b57b5237463a65d25f0ffa5efa3c8505553da4b
19:fcb63a105965 2014-02-20 mbed_official Synchronized with git revision 87193889326571b560379153239787775654be59
18:78bdbce94509 2014-02-18 mbed_official Synchronized with git revision 3c8f1c0c59bc1b665e9e1b1b3dc00e5fcdde6400
17:bbd6dac92961 2014-01-23 mbed_official Synchronized with git revision b7a925e3cf046d2c5a95f80b14d6c285afbdfa7e
16:4f6df64750bd 2013-12-05 mbed_official Synchronized with git revision fa451a0f0ae4ea99e333083931cc5bfc77b27b42
15:849c0c0f2769 2013-11-05 mbed_official Synchronized with git revision cf71d0831be92a7fff88da13626ef25dd94fa185
14:d495202c90f4 2013-09-12 bogdanm Synchronized with git revision b9d52bda50a692c05a4587bcc8d3219997444f58
13:16731886c049 2013-09-10 bogdanm Sync with git revision 171dda705c947bf910926a0b73d6a4797802554d
12:6030a12b6c62 2013-08-08 emilmont Synch with latest https://github.com/mbedmicro/mbed changes
11:eeb3cbbaa996 2013-08-05 bogdanm Bug fixes, added suppor for LPC1347
10:1e3d126a322b 2013-05-30 emilmont Add LPC4088 target
9:354942d2fa38 2013-03-04 samux kl25z: use malloc to allocate only endpoints needed
8:335f2506f422 2013-03-01 samux add FRDM-KL25Z support
7:f8f057664123 2013-01-21 samux modify USBMSD prototypes to fit latest sdfilesystem lib
6:d0945750af57 2012-12-20 samux USBSerial: detect when a terminal is connected
5:d27e4c226965 2012-10-14 samux USBMSD: fixed uninitialized variable (stage, csw, cbw) -> fixed dynamic init
4:eaa07ce86d49 2012-10-14 samux fixed doxygen typo
3:6d85e04fb59f 2012-10-14 samux move EnableIRQ to connect() - add MEDIA_REMOVAL handling
2:34856a6adb5b 2012-07-17 samux Update USBDevice.h
1:80ab0d068708 2012-07-17 samux Update USBDevice lib
0:d8db74b663b3 2012-07-17 mbed_official First commit of the mbed official USB device library