Hi all,
I'm trying to run the SPPdemo (on MSP430F5438A microcontroller) example using an external fast clock (25MHz) as source rather than the internal DCO as in the original application.
I modified the SPPdemo code (HAL.c) as follow:
the StartCrystalOscillator(void) was modified in order to enable the XT2IN and XT2OUT pins to use the external clock.
static void StartCrystalOscillator(void)
{
/* Set up XT1 Pins to analog function, and to lowest drive */
P7SEL |= (BIT1 | BIT0);
/* Set up XT2 Pins to analog function */
P5SEL |= (BIT3 | BIT2);
/* Set internal cap values. */
UCSCTL6 |= XCAP_3;
/* Loop while the Oscillator Fault bit is set. */
while(SFRIFG1 & OFIFG)
{
while (SFRIFG1 & OFIFG)
{
/* Clear OSC fault flags. */
UCSCTL7 &= ~(DCOFFG + XT1LFOFFG + XT1HFOFFG + XT2OFFG);
SFRIFG1 &= ~OFIFG;
}
/* Reduce the drive strength. */
UCSCTL6 &= ~(XT1DRIVE1_L + XT1DRIVE0);
/* Maximum drive strength for XT2 (25 MHz). */
UCSCTL6 |= (XT2DRIVE1|XT2DRIVE0);
}
}
In order to disable DCO/FLL, in the SetSystemClock(Cpu_Frequency_t CPU_Frequency) i commented the code from
/* Set DCO to lowest Tap. */
UCSCTL0 = 0x0000;
to the end of the function.
Applying this modifications the program fails in the BSC_Initialize(HCI_DriverInformation, 0); during stack opening....
What is wrong? Any suggestions?
Thanks in advance,
Giacinto Luigi Cerone