之前遇到过MSP430FR5969如果配置成16MHz的DCO程序跑飞的情况,今天再次遇到,找到原来的解决办法拿出来给有需要的朋友。
MSP430FR5969的最高主频可达到16MHz,铁电存储器在MCLK主频在高于8MHz时需要对FRCTL0寄存器的NWAITS(Wait state control. Specifies number of wait states (0to 7) required for an FRAM
access (cache miss). 0 implies no wait states.)处进地配置
在官方例程msp430fr59xx_cs_02.c里有这样一段代码
- // Configure one FRAM waitstate as required by the device datasheet for MCLK
- // operation beyond 8MHz _before_ configuring the clock system.
- FRCTL0 = FRCTLPW | NWAITS_1;
把这段代码放在配置DCO之前就可以正常使用16MHz DCO了。
- void dco_init(void)
- {
- // Configure one FRAM waitstate as required by the device datasheet for MCLK
- // operation beyond 8MHz _before_ configuring the clock system.
- FRCTL0 = FRCTLPW | NWAITS_1;
-
- // Clock System Setup
- CSCTL0_H = CSKEY >> 8; // Unlock CS registers
- CSCTL1 = DCORSEL | DCOFSEL_4; // Set DCO to 16MHz
- CSCTL2 = SELA__VLOCLK | SELS__DCOCLK | SELM__DCOCLK; // Set SMCLK = MCLK = DCO,
- // ACLK = VLOCLK
- CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Set all dividers
- CSCTL0_H = 0; // Lock CS registers
- }
本帖最后由 littleshrimp 于 2015-6-18 13:29 编辑