This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
Hi all,
We are trying to use the MSP430FR5969 in a custom board that uses a 16Mhz ceramic oscillator(ABM8AAIG-16.00MHZ-V2R-T3). We are trying to configure the HFXT oscilltor as the clock source ,
we have referred the example code provided and have followed the same but the code is stuck in a loop at the end.
problem: The OFIFG Bit is never reset.This bit is a Oscillator Fault Flag that has to be cleared initially and then checked again but it is set after each clear.
testing: We are checking the SMCLK clk after the clock switch is done to verify that the switch has happened.Hence we have set the pin P3.4 as SMCLK.
if we remove the loop condition and test , the program runs. to check we implemented a pwm and ran it for 50%duty cycle of 8000 counts. if we calculate the actual freq available on a CRO we get around 5Mhz.
The code /Configuration we are doing:
void main()
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
PM5CTL0 &= ~LOCKLPM5; //Disable high Impendence
P3DIR |= BIT4; // Output SMCLK
P3SEL1 |= BIT4; //SMCLK Function select
PJSEL0 |= BIT6 | BIT7; // For HFXT
FRCTL0 = FRCTLPW | NACCESS_1; //Wait state for the FRAM if clk is greater than 8Mhz
CSCTL0_H = CSKEY >> 8; // Unlock CS registers
CSCTL1 = DCOFSEL_6; // Set DCO to 8MHz
CSCTL2 = SELA__LFXTCLK | SELS__HFXTCLK | SELM__HFXTCLK;
CSCTL3 = 0; // Set all dividers to 1
CSCTL4 = HFXTDRIVE_3 | HFFREQ_3; //Give max drive and freq range 16-24
Mhz
do
{
CSCTL5 &= ~(HFXTOFFG); // Clear XT1 and XT2 fault flag
SFRIFG1 &= ~OFIFG;
}while (SFRIFG1&OFIFG); // Test oscillator fault flag
CSCTL0_H = 0; //LOCK CS
while(1)
{
;
}
}
any advice is much appreciated
Thank you
Hello Ruthvik,
I think maybe you can try to set the HFFREQ to 10 because I think the 16 MHz not bigger than 16 MHz, It should belongs to "> 8 MHz to 16 MHz"
Best Regards,
Janz Bai
Hello Ruthvik,
Because I don't have device to do tests now and I think you can try to refer to these previous E2E post, and refer to our user guide to check whether it can resolve your issue.
Best Regards,
Janz Bai
The Issue Has been resolved.
The issue was caused due to the OFIFG being always being set. This is an oscillator fault flag which will be set when any of the oscillator fault flags like HFXT,LFXT... are set.
By default, in our application we are only using the HFXT oscillator and the DCO as a Backup. As per the Datasheet the LFX pins are general purpose GPIOs unless there is a LFXT and are set as such. But for the auxilary clock the default source is the LFX which would be set even if the LFXT was not present ,This caused an LFXT fault to set and thus setting the OFIFG. once we clear all the dependencies of the LFXT we were able to switch the clock to HFXT without issue.
Also while reading some posts, we got to know the about the wait staes for the FRAM was needed. so that also helped solving a future problem.
Thanks and Regards,
Ruthvilk R
Hello Ruthvik,
Sounds good that you have resolved it. Congratulations!
Best Regards,
Janz Bai
**Attention** This is a public forum