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.

CCS/MSP430FW427: problem with MSP430FW427 timer

Part Number: MSP430FW427
Other Parts Discussed in Thread: MSP430G2553

Tool/software: Code Composer Studio

Hi.
I am trying to make a timer interruption with the MSP430FW427, but I have not found support information on the internet. The information I found is about the timers of the MSP430G2553 or the F5529.
I appreciate if someone can help me with information or links on how to manage the timer, how to calculate the times and how to adjust the clock signals.

  • If you go to TI.COM, then type your part number into the search box, you'll be given a link to here:
    www.ti.com/.../MSP430FW427

    The User Guide (for the F4 series) and the Data Sheet (for your part in particular) are provided at the top of the page. You probably want to start with the User Guide section on "Timer A".

    The Tools and Software tab provides downloadable "Code Examples" appropriate to your part.
  • You can also find all information in the TI Resource Explorer. http://dev.ti.com/ti-rex

    Here you can find the data sheet, User's Guide, Errata, but also code examples etc.
    dev.ti.com/.../

    Best regards,
    Andre

  • Hi.

    Thanks for the link. Check the example codes but none worked for what I'm doing. Do you have any code or link that explains how to work with a timer at a high frequency? the problem is that in the examples that I saw all are based on a 32Khz crystal and in my case I must make the interruptions at a frequency of at least 10 Mhz with any clock source.

  • Example fet410_ta_03.c uses SMCLK, which can run as fast as the CPU (MCLK).

    However, with an 8MHz CPU you will not succeed in interrupting at 10MHz. If your program doesn't do anything else, you might succeed at 400kHz.

    Based on the Inputs table (data sheet (SLA383e) p. 22), you might be able to count pulses up to 10MHz.
  • Hi.

    Thanks for your answer. What I need is an MCLK frequency of at least 10 Mhz and with this I carry out the interruptions to different periods (the periods vary according to the execution of the program). I need this frequency because of the calculation operations that the CPU must do. My questions are:

    How can you configure an MCLK frequency of at least 10 MHz? I know how to do it with the G2553 or the F5529, but the header file "msp430FW427.h" has different declarations.

    How can I make interruptions with this MCLK frequency having good accuracy with the interruption period? That is, achieve periods of 5us, or 10us relatively accurate.

    How can I calculate these periods?

    I thank you for the link of examples, it is what I needed. I will review the fet410_ta_03.c example more thoroughly.
  • Per the "Recommended Operating Conditions" table (data sheet p. 19) the maximum MCLK is 8MHz. Example fet410_fll_02.c claims to set MCLK to 8MHz.

    Even if you could run the FW427 at 10MHz, you would still not be able to interrupt at that rate -- that would allow 1 CPU cycle to process each interrupt, where you should probably estimate at least 20 CPU cycles.

    If you can provide more context, maybe someone here will think of an alternative way of doing what you want to do.

  • Hi.
    Thanks for that information. Then I misunderstood the table on page 31 of the data sheet. I did not know that the maximum speed is 8 Mhz for MCLK.
    I'm going to adjust the rest of my code to move to 8 Mhz. I was reviewing the examples in the link given to me by Bruce McKenney47378 and there all use the 32 kHz signal (ACLK) for the Timmer. How can I use the same 8 Mhz frequency of the MCLK for the timmer?

  • Example fet410_ta_03.c uses SMCLK (1.048576 MHz), not ACLK. Example fet410_cs_02.c shows how to set the DCO to ~8MHz.

    The 32kHz crystal "requirement" in each of the examples comes from the FLL+ clock system, which uses an external crystal to tune the DCO. If you don't have such a crystal, you may need to fiddle with the FLLD values (and maybe the "DCO" value) to get 8MHz. There don't appear to be anything like the CALDCO/BC1 constants found in the (e.g.) G2553.

    Example fet410_cs_02.c is a place to start. [Hint: Since you don't have a reference, I'm guessing you'll want to turn off the FLL with something like "__BIS_SR(SCG0);" Ref User Guide SLAU056L sec 5.2.8]

    Can you do some of your application without changing the MCLK/SMCLK? At startup it's at something close to 1MHz.
  • Hi, thanks for the collaboration.

    With this code the interruptions are made as the example says every 33 ms approximately.

    #include <msp430.h>

    unsigned int alfa=0

    int main(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT
    SCFI0 |= FN_3; // Set DCO operating range
    SCFQCTL = 121; // (121+1) x 32768 x 2 = 7.99 Mhz
    FLL_CTL0 = DCOPLUS + XCAP18PF; // DCO+ set so freq = xtal x D x N+1
    CCTL0 = CCIE; // CCR0 interrupt enabled
    CCR0 = 1000 - 1;
    TACTL = TASSEL_1 + MC_1; // ACLK, up mode
    __bis_SR_register(GIE); // interrupt enable
    ......... //algoritmo
    }
    #pragma vector=TIMER0_A0_VECTOR
    __interrupt void Timer_A (void)
    {
    alfa++;
    }

    With this code the interrupts are made every 3 us approximately, but I do not know why the CPU speed drops, I do not know that I'm wrong because I thought that with "TASSEL_2" only changed the signal for the timmer but it seems that also modifies MCLK.

    #include <msp430.h>
    unsigned int alfa=0;
    int main(void)
    {
    WDTCTL = WDTPW + WDTHOLD; // Stop WDT
    SCFI0 |= FN_3; // Set DCO operating range
    SCFQCTL = 121; // (121+1) x 32768 x 2 = 7.99 Mhz
    FLL_CTL0 = DCOPLUS + XCAP18PF; // DCO+ set so freq = xtal x D x N+1

    CCTL0 = CCIE; // CCR0 interrupt enabled
    CCR0 = 20; //20 ciclos para cada interrupcion
    TACTL = TASSEL_2 + MC_1; // SMCLK, up mode
    __bis_SR_register(GIE); // interrupt enable
    ................... // algoritmo
    }
    #pragma vector=TIMER0_A0_VECTOR
    __interrupt void Timer_A (void)
    {
    alfa++;
    }

    How can I get the maximum frequency of MCLK and timmer with a 32 Khz crystal?
  • 21 clocks at 8MHz is about 2.6usec, so that measurement looks about right. My guess is that you're pretty close to the limit, since your ISR probably takes about that many clocks.

    How did you conclude that MCLK is slowing down? Keep in mind that, at that interrupt rate, your main() will be accomplishing pretty much nothing.

    [Edit: Hit Post too fast.]

  • Hello

    Yes, what you say is true. I noticed a reduction in the speed of some calculations that I could see in an LCD, but I suppose it is because a lot of the time the ISR consumes part of the processing.

    Anyway, I already have a way to synchronize this.

    Friend, thanks for the help.

**Attention** This is a public forum