Part Number: MSP430F5328
Other Parts Discussed in Thread: MSP430F5438A
Hello,
I am using a MSP430F5438A and MSP430F5328 in my project.
In the project of the MSP430F5328 I have to run the code as fast as possible after power up. The project is using XT2 as clock source with a 20 MHz cristal.
During the initialization of the project there is waited till the clock is stable. As we want to run the program with a stable clock.
That is done in the same way as in TI example: "MSP430F532x_OF_LFXT1_nmi":
do
{
UCSCTL7 &= ~(XT1LFOFFG + DCOFFG); // Clear XT1 & DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear OSC Fault flag
for (i = 0x0FFF; i > 0; i--); // Time for flag to set????
P1OUT ^= BIT0; // Toggle P1.0
}while ( (SFRIFG1 & OFIFG) );
When I look at the example for the MSP430F5438A (msp430x54xA_OF_LFXT1_nmi) I see that the for loop is much larger:
do
{
UCSCTL7 &= ~(XT1LFOFFG + DCOFFG); // Clear XT1 & DCO fault flags
SFRIFG1 &= ~OFIFG; // Clear OSC Fault flag
for (i = 0xFFFF; i > 0; i--); // Time for flag to set
P1OUT ^= BIT0; // Toggle P1.0 using exclusive-OR
}while ( (SFRIFG1 & OFIFG) );
1. Why are these wait times different?
2. What is the preferred method to wait till the clock is stable?
3. How can I run the program as fast as possible with a stable clock?
4. Can I shorten those wait times (or remove the delay at all) and what are the risks then?
Thank you in advance,
Jeroen