最近搞lpc2368,在设置MAM时不能设置,而且是程序死在那里,我的系统时钟是48(程序测得)兆,按datasheet上说应该设置成3,可就是不行,只能设置为5.6.7,而我把它写到09年版本的2368上确可以设置,我现在用的是1014版,应该是新版啊,请大家赐教,今晚回家等答案。。。。。
static void MAM_Init (void)
{
CPU_INT32U clk_freq;
clk_freq = BSP_CPU_ClkFreq(); /* Get the current core clock frequency */
debug_init(); //调试状态初始化 串口0
DEBUG("MAMTIM0 %d",MAMTIM);
DEBUG("clk_freq0 %d",clk_freq);
MAMCR = 0; /* Disable MAM functionality */
if (clk_freq < 20000000) { /* Compare current clock frequency with MAM modes */
MAMTIM = 1; /* Set MAM fetch cycles to 1 processor clock in duration */
}
if (clk_freq < 40000000) {
MAMTIM = 2; /* Set MAM fetch cycles to 2 processor clock in duration */
}
if (clk_freq >= 40000000) {
MAMTIM = 3; /* Set MAM fetch cycles to 3 processor clock in duration */
}
DEBUG("MAMTIM1 %d",MAMTIM);
DEBUG("clk_freq1 %d",clk_freq);
MAMCR = 2; /* Enable full MAM functionality */
} |