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.

History

Added Nucleo F401RE support default tip

2014-03-30, by tolaipner [Sun, 30 Mar 2014 07:30:18 +0000] rev 24

Added Nucleo F401RE support


Nucleo F401RE support

2014-03-30, by tolaipner [Sun, 30 Mar 2014 07:24:27 +0000] rev 23

Nucleo F401RE support


Nucleo F401RE support

2014-03-30, by tolaipner [Sun, 30 Mar 2014 07:24:02 +0000] rev 22

Nucleo F401RE support


Synchronized with git revision 3d49a491d4dd16466354746d3c329428840f5a03

2014-03-27, by mbed_official [Thu, 27 Mar 2014 09:45:42 +0000] rev 21

Synchronized with git revision 3d49a491d4dd16466354746d3c329428840f5a03

Full URL: https://github.com/mbedmicro/mbed/commit/3d49a491d4dd16466354746d3c329428840f5a03/

Fixed readNB() bug


Synchronized with git revision 6b57b5237463a65d25f0ffa5efa3c8505553da4b

2014-02-27, by mbed_official [Thu, 27 Feb 2014 09:45:46 +0000] rev 20

Synchronized with git revision 6b57b5237463a65d25f0ffa5efa3c8505553da4b

Full URL: https://github.com/mbedmicro/mbed/commit/6b57b5237463a65d25f0ffa5efa3c8505553da4b/

add D0-D13 and A0-A5 for Arch V1.1 and Arch Pro


Synchronized with git revision 87193889326571b560379153239787775654be59

2014-02-20, by mbed_official [Thu, 20 Feb 2014 11:15:58 +0000] rev 19

Synchronized with git revision 87193889326571b560379153239787775654be59

Full URL: https://github.com/mbedmicro/mbed/commit/87193889326571b560379153239787775654be59/

libraries/USBSerial: Allow the USB connection to be non-blocking


Synchronized with git revision 3c8f1c0c59bc1b665e9e1b1b3dc00e5fcdde6400

2014-02-18, by mbed_official [Tue, 18 Feb 2014 11:00:19 +0000] rev 18

Synchronized with git revision 3c8f1c0c59bc1b665e9e1b1b3dc00e5fcdde6400

Full URL: https://github.com/mbedmicro/mbed/commit/3c8f1c0c59bc1b665e9e1b1b3dc00e5fcdde6400/

Allow USBDevice::connect() to be non-blocking


Synchronized with git revision b7a925e3cf046d2c5a95f80b14d6c285afbdfa7e

2014-01-23, by mbed_official [Thu, 23 Jan 2014 17:30:20 +0000] rev 17

Synchronized with git revision b7a925e3cf046d2c5a95f80b14d6c285afbdfa7e

Full URL: https://github.com/mbedmicro/mbed/commit/b7a925e3cf046d2c5a95f80b14d6c285afbdfa7e/

LPC11U35 support for USBDevice and mbed-rtos


Synchronized with git revision fa451a0f0ae4ea99e333083931cc5bfc77b27b42

2013-12-05, by mbed_official [Thu, 05 Dec 2013 13:00:15 +0000] rev 16

Synchronized with git revision fa451a0f0ae4ea99e333083931cc5bfc77b27b42

Full URL: https://github.com/mbedmicro/mbed/commit/fa451a0f0ae4ea99e333083931cc5bfc77b27b42/

Add initial USB Device support for STM32F4


Synchronized with git revision cf71d0831be92a7fff88da13626ef25dd94fa185

2013-11-05, by mbed_official [Tue, 05 Nov 2013 09:45:23 +0000] rev 15

Synchronized with git revision cf71d0831be92a7fff88da13626ef25dd94fa185