SLAZ685L February 2017 – August 2021 MSP430FR5992
CS Module
Functional
DCO overshoot at frequency change
When changing frequencies (CSCTL1.DCOFSEL), the DCO frequency may overshoot and exceed the datasheet specification. After a time period of 10us has elapsed, the frequency overshoot settles down to the expected range as specified in the datasheet. The overshoot occur when switching to and from any DCOFSEL setting and impacts all peripherals using the DCO as a clock source. A potential impact can also be seen on FRAM accesses, since the overshoot may cause a temporary violation of FRAM access and cycle time requirements.
When changing the DCO settings, use the following procedure:
1) Store the existing CSCTL3 divider into a temporary unsigned 16-bit variable
2) Set CSCTL3 to divide all corresponding clock sources by 4 or higher
3) Change DCO frequency
4) Wait ~10us
5) Restore the divider in CSCTL3 to the setting stored in the temporary variable.
The following code example shows how to increase DCO to 16MHz.
uint16_t tempCSCTL3 = 0;
CSCTL0_H = CSKEY_H; // Unlock CS registers
/* Assuming SMCLK and MCLK are sourced from DCO */
/* Store CSCTL3 settings to recover later */
tempCSCTL3 = CSCTL3;
/* Keep overshoot transient within specification by setting clk sources to divide by 4*/
/* Clear the DIVS & DIVM masks (~0x77)and set both fields to 4 divider */
CSCTL3 = CSCTL3 & (~(0x77)) | DIVS__4 | DIVM__4;
CSCTL1 = DCOFSEL_4 | DCORSEL; // Set DCO to 16MHz
/* Delay by ~10us to let DCO settle. 60 cycles = 20 cycles buffer + (10us / (1/4MHz)) */
__delay_cycles(60);
CSCTL3 = tempCSCTL3; // Set all dividers
CSCTL0_H = 0; // Lock CS registers