stm32l4: Enable PWR module and USV-bit in CR2.
This commit is contained in:
@@ -61,6 +61,11 @@ clock_init (void)
|
||||
(0x00 << 2) | /* PCLK for USART2 */
|
||||
(0x00 << 0) ); /* PCLK for USART1 */
|
||||
|
||||
/* Enable PWR clock */
|
||||
RCC->APB1ENR1 |= (1 << 28);
|
||||
RCC->APB1RSTR1 = (1 << 28);
|
||||
RCC->APB1RSTR1 = 0;
|
||||
|
||||
/* Enable HSI48 clock */
|
||||
RCC->CRRCR |= 1;
|
||||
while ((RCC->CRRCR & 0x02) == 0)
|
||||
|
||||
@@ -65,6 +65,8 @@ static struct CRS *const CRS = ((struct CRS *)(APB1PERIPH_BASE + 0x6000));
|
||||
void
|
||||
usb_lld_sys_init (void)
|
||||
{
|
||||
PWR->CR2 |= (1 << 10); /* USB supply valid */
|
||||
|
||||
if ((RCC->APB1ENR1 & RCC_APB1_1_USB)
|
||||
&& (RCC->APB1RSTR1 & RCC_APB1_1_USB) == 0)
|
||||
/* Make sure the device is disconnected, even after core reset. */
|
||||
|
||||
Reference in New Issue
Block a user