Other Parts Discussed in Thread: MSP430FR5959
Hello expert,
In my project, I used MSP430FR5959, and 2 different clocks' setting for 2 working mode.
For high frequency mode, I configured the clock as below:
void sysclock_Init(void)
{
PJSEL0 |= BIT6 | BIT7; // For XT2
CSCTL0_H = CSKEY >> 8; // Unlock CS registers
CSCTL2 = SELA__VLOCLK | SELS__HFXTCLK | SELM__HFXTCLK; //SELM__HFXTCLK
CSCTL3 = DIVA__1 | DIVS__8 | DIVM__32; // Set all dividers to 1
CSCTL4 |= HFXTDRIVE_0 | HFFREQ_1; //
CSCTL4 &= ~(HFXTOFF);
do
{
CSCTL5 &= ~(HFXTOFFG); // Clear XT1 and XT2 fault flag
SFRIFG1 &= ~OFIFG;
}while (SFRIFG1&OFIFG); // Test oscillator fault flag
CSCTL0_H = 0; // Lock CS registers
}
For the low frequency working mode, I configured the clock as:
void sysclock_LowPowerMode( void )
{
CSCTL0_H = CSKEY >> 8; // Unlock CS registers
CSCTL2 = SELA__VLOCLK | SELS__LFMODCLK | SELM__LFMODCLK; // SELM__HFXTCLK
// CSCTL2 = SELA__VLOCLK | SELS__VLOCLK | SELM__VLOCLK;
CSCTL3 = DIVA__1 | DIVS__1 | DIVM__1; // Set all dividers to 1
CSCTL4 |= HFXTOFF;
CSCTL0_H = 0; // Lock CS registers
}
When the device worked at low frequency mode, MCU will read the data from a SPI sensor, but the data is not stable. But I don't change the clock to low frequency mode, the MCU is working at high frequency mode, the data reading by SPI, the data is OK.
Please help me to check, why the SPI reading is not stable when the MCU works at low frequency mode?
Thanks a lot!