BSP包里面的ISP_CAN
学习了一下 ISP部分的CAN:
void SYS_Init(void)
{
/* Enable Internal and External RC clock */
CLK->PWRCTL |= CLK_PWRCTL_HIRCEN_Msk | CLK_PWRCTL_HXTEN_Msk;
/* Waiting for Internal RC clock ready */
while (!(CLK->STATUS & CLK_STATUS_HIRCSTB_Msk));
/* Set core clock as PLL_CLOCK from PLL */
CLK->PLLCTL = PLLCON_SETTING;
while (!(CLK->STATUS & CLK_STATUS_PLLSTB_Msk));
CLK->CLKSEL0 = (CLK->CLKSEL0 & (~CLK_CLKSEL0_HCLKSEL_Msk)) | CLK_CLKSEL0_HCLKSEL_PLL;
CLK->CLKDIV0 &= ~CLK_CLKDIV0_HCLKDIV_Msk;
CLK->CLKDIV0 |= CLK_CLKDIV0_HCLK(HCLK_DIV);
/* Update System Core Clock */
/* User can use SystemCoreClockUpdate() to calculate PllClock, SystemCoreClock and CycylesPerUs automatically. */
//SystemCoreClockUpdate();
PllClock = PLL_CLOCK; // PLL
SystemCoreClock = PLL_CLOCK / HCLK_DIV; // HCLK
CyclesPerUs = SystemCoreClock / 1000000; // For SYS_SysTickDelay()
}
|