mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-19 15:40:41 +00:00
stm32f4: Enable USB peripheral, fix typos in register writes.
This commit is contained in:
parent
03cbd406cb
commit
657d3e2983
@ -85,13 +85,18 @@ void board_init(void)
|
|||||||
RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;
|
RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;
|
||||||
|
|
||||||
// USB Pin Init
|
// USB Pin Init
|
||||||
// PA10- ID, PA11- DM, PA12- DP
|
// PA9- VUSB, PA10- ID, PA11- DM, PA12- DP
|
||||||
// PC0- Power on
|
// PC0- Power on
|
||||||
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
|
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
|
||||||
GPIOD->MODER |= GPIO_MODER_MODE10_1 | GPIO_MODER_MODE11_1 | \
|
GPIOA->MODER |= GPIO_MODER_MODE9_1 | GPIO_MODER_MODE10_1 | \
|
||||||
GPIO_MODER_MODE12_1;
|
GPIO_MODER_MODE11_1 | GPIO_MODER_MODE12_1;
|
||||||
GPIOA->AFR[1] |= (10 << GPIO_AFRH_AFSEL10_Pos) | \
|
GPIOA->AFR[1] |= (10 << GPIO_AFRH_AFSEL9_Pos) | \
|
||||||
(10 << GPIO_AFRH_AFSEL11_Pos) | (10 << GPIO_AFRH_AFSEL12_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,7 +78,9 @@ bool dcd_init (uint8_t rhport)
|
|||||||
USB_OTG_FS->GINTMSK |= USB_OTG_GINTMSK_USBRST | USB_OTG_GINTMSK_ENUMDNEM | \
|
USB_OTG_FS->GINTMSK |= USB_OTG_GINTMSK_USBRST | USB_OTG_GINTMSK_ENUMDNEM | \
|
||||||
USB_OTG_GINTMSK_ESUSPM | USB_OTG_GINTMSK_USBSUSPM | \
|
USB_OTG_GINTMSK_ESUSPM | USB_OTG_GINTMSK_USBSUSPM | \
|
||||||
USB_OTG_GINTMSK_SOFM;
|
USB_OTG_GINTMSK_SOFM;
|
||||||
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_VBUSBSEN; // Enable pullup.
|
|
||||||
|
// Enable pullup, enable peripheral.
|
||||||
|
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_VBUSBSEN | USB_OTG_GCCFG_PWRDWN;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user