Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Enable the IRC48Mhz clock */
- #if (CLOCK_SETUP == 2) || (CLOCK_SETUP == 3) || (CLOCK_SETUP == 4)
- SIM->CLKDIV2 = 0x00u; /* Set USB Clock Divider Divisor and USB clock Divider fraction to 0 because 48MHz is the correct frequency already */
- SIM_SOPT2_REG(SIM_BASE_PTR) |= SIM_SOPT2_USBSRC_MASK | SIM_SOPT2_PLLFLLSEL(3); /* Configure USB to be clocked from IRC 48MHZ */
- SIM_SCGC4_REG(SIM_BASE_PTR) |= SIM_SCGC4_USBOTG_MASK; /* ungate clock to USB Module to allow configuration of module registers */
- volatile uint8_t *usb_irc_en_adr = (uint8_t*)0x40072144u; /* IRC48M Oscillator enable register */
- *usb_irc_en_adr |= BM_USB_CLK_RECOVER_IRC_EN_REG_EN | BM_USB_CLK_RECOVER_IRC_EN_IRC_EN; /* Enable IRC48M and IRC48M regulator */
- volatile uint8_t *usb_clk_recovery = (uint8_t*)0x40072140u; /* USB Clock recovery control register */
- *usb_clk_recovery |= BM_USB_CLK_RECOVER_CTRL_CLOCK_RECOVER_EN; /* Crysal-less USB enable */
- #endif
Advertisement
Add Comment
Please, Sign In to add comment