请问各位高手,晶振由11.0592M改为20M,改为如下后上电不运行。
config.h ---------------------------------------- #define Fosc 20000000 // 由11059200 #define Fcclk (Fosc * 1) #define Fcco (Fcclk * 2) #define Fpclk (Fcclk / 4) * 1
target.c 这个文件不要改吧 ---------------------------------------- // 设置系统各部分时钟 // Set system timers for each component PLLCON = 1; // 设置激活但未连接PLL // 设置外设(VPB时钟pclk)时钟与系统(cclk)时钟的分频比 #if (Fpclk / (Fcclk / 2)) == 1 VPBDIV = 0; #endif #if (Fpclk / (Fcclk / 2)) == 2 VPBDIV = 2; #endif #if (Fpclk / (Fcclk / 2)) == 4 VPBDIV = 1; #endif
// 设定PLL的乘因子M和除因子P的值 #if (Fcco / Fcclk) == 2 PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5); #endif #if (Fcco / Fcclk) == 4 PLLCFG = ((Fcclk / Fosc) - 1) | (1 << 5); #endif #if (Fcco / Fcclk) == 8 PLLCFG = ((Fcclk / Fosc) - 1) | (2 << 5); #endif #if (Fcco / Fcclk) == 16 PLLCFG = ((Fcclk / Fosc) - 1) | (3 << 5); #endif PLLFEED = 0xaa; PLLFEED = 0x55; while((PLLSTAT & (1 << 10)) == 0); // 等待锁定 PLLCON = 3; // 设置激活并连接PLL PLLFEED = 0xaa; // 发送PLL馈送序列,执行激活和
连接动作. PLLFEED = 0x55;
// 设置存储器加速模块 /* Set memory accelerater module*/ MAMCR = 0; #if Fcclk < 20000000 MAMTIM = 1; #else #if Fcclk < 40000000 MAMTIM = 2; #else MAMTIM = 3; #endif #endif MAMCR = 2; |