使用Atmel公司的at91rm9200
看了一个主时钟建立的程序,一直不明白为什么在建立之前要先写一个dirty value到MCKR,然后再写入我们期望的值到MCKR,为什么不直接写入期望值呢。
代码如下:
/*---------------------------------------------------------------------------- */
/* Step 5. */
/* Selection of Master Clock MCK (and Processor Clock PCK) */
/*---------------------------------------------------------------------------- */
/* Constraints of the Master Clock selection sequence */
/* Write in the MCKR dirty value concerning the clock selection CSS then overwrite it in a second sequence */
AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_CSS_SLOW_CLK;
/* Wait until the master clock is established */
tmp = 0;
while( !(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY) && (tmp++ < DELAY_MAIN_FREQ) );
/* Second sequence */
AT91C_BASE_PMC->PMC_MCKR = MCKR_Register;/*期望值*/
高手指点一下吧