November 22, 2024, 10:29:40 AM

MSP430-T5510

Started by Franz Peter, January 14, 2022, 10:24:43 AM

Previous topic - Next topic

Franz Peter

I want to use the 4-MHz-crystal, which is on the board (XT2). However: it is not working. The ACLK-clock should be 125 kHz - but it is only 8 kHz (round about). What is wrong in my code? Maybe someone has had the same problem......
Franz Peter


int main(void)
{
    WDTCTL = WDTPW | WDTHOLD;   // Stop watchdog timer

    P5SEL |= BIT2;            //use Pin for crystal XTC2
    P5SEL |= BIT3;            //use Pin for crystal XTC2
    UCSCTL6 &= ~XT2OFF;         //activate XT2; 4 MHz
    UCSCTL6 &= ~XT2BYPASS;      //use external crystal
    UCSCTL6 &= ~SMCLKOFF;      //SMCLK is on
    UCSCTL4 = SELA__XT2CLK;      //select cristal oscillator XT2 for ACLK
    UCSCTL4 |= SELS__XT2CLK;   //select cristal oscillator XT2 for SMCLK
    UCSCTL4 |= SELM__XT2CLK;   //select cristal oscillator XT2 for MCLK

    UCSCTL5 = DIVS__4;         //SMCLK/4 = 1 MHz
    UCSCTL5 = DIVA__32;         //ACLK/32 = 125 kHz