1.设置引脚Mode
ioport_set_pin_mode(PIO_PA17_IDX,IOPORT_MODE_MUX_B);//把PA17复用为PCK1
ioport_disable_pin(PIO_PA17_IDX);
ioport_set_pin_mode(PIO_PA18_IDX,IOPORT_MODE_MUX_B);//把PA18复用为PCK2
ioport_disable_pin(PIO_PA18_IDX);
2.设置PMC,使能输出
2.1寄存器
PMC->PMC_PCK[1] |= PMC_PCK_CSS_MCK | PMC_PCK_PRES_CLK_32;
PMC->PMC_IER |= PMC_IER_PCKRDY1;
PMC->PMC_SCER |= PMC_SCER_PCK1;
PMC->PMC_PCK[2] |= PMC_PCK_CSS_SLOW_CLK ;
PMC->PMC_IER |= PMC_IER_PCKRDY2;
PMC->PMC_SCER |= PMC_SCER_PCK2;
2.2 库函数
pmc_switch_pck_to_pllack(1,PMC_PCK_PRES_CLK_32);
pmc_enable_pck(1);
pmc_switch_pck_to_sclk(2,PMC_PCK_PRES_CLK_1);
pmc_enable_pck(2);