summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorWilliam D. Jones <[email protected]>2019-01-13 17:34:09 -0500
committerWilliam D. Jones <[email protected]>2019-01-13 18:36:18 -0500
commit657d3e2983558831cd5525b2c5aa3bef27f9468b (patch)
tree7cb083a83482747dd2b9e5e4ed22bd73626fb6b0 /hw
parent03cbd406cb16ff2da5b11775e0d34d7d53f5ea45 (diff)
stm32f4: Enable USB peripheral, fix typos in register writes.
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c b/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c
index f08cecac8..30239de50 100644
--- a/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c
+++ b/hw/bsp/stm32f407g_disc1/board_stm32f407g_disc1.c
@@ -85,13 +85,18 @@ void board_init(void)
RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;
// USB Pin Init
- // PA10- ID, PA11- DM, PA12- DP
+ // PA9- VUSB, PA10- ID, PA11- DM, PA12- DP
// PC0- Power on
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
- GPIOD->MODER |= GPIO_MODER_MODE10_1 | GPIO_MODER_MODE11_1 | \
- GPIO_MODER_MODE12_1;
- GPIOA->AFR[1] |= (10 << GPIO_AFRH_AFSEL10_Pos) | \
- (10 << GPIO_AFRH_AFSEL11_Pos) | (10 << GPIO_AFRH_AFSEL12_Pos);
+ GPIOA->MODER |= GPIO_MODER_MODE9_1 | GPIO_MODER_MODE10_1 | \
+ GPIO_MODER_MODE11_1 | GPIO_MODER_MODE12_1;
+ GPIOA->AFR[1] |= (10 << GPIO_AFRH_AFSEL9_Pos) | \
+ (10 << GPIO_AFRH_AFSEL10_Pos) | (10 << GPIO_AFRH_AFSEL11_Pos) | \
+ (10 << GPIO_AFRH_AFSEL12_Pos);
+
+ // Pullup required on ID, despite the manual claiming there's an
+ // internal pullup already (page 1245, Rev 17)
+ GPIOA->PUPDR |= GPIO_PUPDR_PUPD10_0;
}