Jump to content

MSP430 LaunchPad, DriverLib, TIMER_A and CCR0 Duration

Recommended Posts



I am trying to determine the frequency of the TIMER_A with a given Capture/Control Register 0 (CCR0) value 0.


My understanding is that the frequency is (SMCLK)* (1/CLOCKSOURCE_DIVIDER)*(1/Number of Cycles)


My configuration:

  • Clock source is SMCLK.  SMCLK frequency is 8MHz (1),
  • CCR0 value is 50000 decimal (0xC350).
  • TIMER_A is set in continuous mode (TIMER_A_CONTINUOUS_MODE)
  • "timer_a_ex2_continous ModeOperationWithCCR-Interrupt"
    • Src: MSP430ware/Libraries/Driver Library/MSP430F5xx_6xx/Example Projects/TIMER_A
    • The only change I made is this: replaced TIMER_A_CLOCKSOURCE_DIVIDER_1 with TIMER_A_CLOCKSOURCE_DIVIDER_16.

f =  (8 MHz)*(1/TIMER_A_CLOCKSOURCE_DIVIDER_16)*(1/50000) = 10Hz


When I execute the code I see the LED blink on and off with an estimated frequency of 0.80s.  I am using a simple timer on my phone to estimate the frequency.


Looks like I am off by one order of magnitude...

What am I missing?

I appreciate any help from the community?


With kind regards,

Electric Cowboy



(1) - "slau533b - MSP-EXP430F5529LP User's Guide.pdf" - page 45/61

(2) - "slau390c - Unified Clock System.pdf", Figure 1-1 UCS Block Diagram - page 3/29.



Code excerpt:


        #define COMPARE_VALUE 50000 // Valid range is 16-bits 0x0000 (0d) to 0xFFFF (65535d)


        //Start timer in continuous mode sourced by SMCLK
        TIMER_A_configureContinuousMode( TIMER_A1_BASE,
                                         TIMER_A_CLOCKSOURCE_DIVIDER_16, // Here I changed from "..._1" to "..._16"


        //Initiaze compare mode

        TIMER_A_startCounter( TIMER_A1_BASE,




Link to post
Share on other sites
  • 2 months later...

Late reply but, Continuous mode counts to 0xFFFF. CCR0 is only used for Up and Up/Down modes.
It should be something like

 Timer_A_initUpModeParam initUpParam = { 0 };
        initUpParam.clockSource = TIMER_A_CLOCKSOURCE_SMCLK;                       // Use ACLK (slower clock)
        initUpParam.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_8;           // Input clock = SMCLK / 8= 1MHz
        initUpParam.timerPeriod = 10000;                                     // Period 1MHz/10000 =100Hz -> WRITTEN IN CCR0
        initUpParam.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_DISABLE;   // Enable TAR -> 0 interrupt
        initUpParam.captureCompareInterruptEnable_CCR0_CCIE =
                TIMER_A_CCIE_CCR0_INTERRUPT_ENABLE;                               // Enable CCR0 compare interrupt
        initUpParam.timerClear = TIMER_A_DO_CLEAR;                                // Clear TAR & clock divider
        initUpParam.startTimer = false;                                           // Don't start the timer, yet
    Timer_A_initUpMode( TIMER_A0_Timer_A_clearTimerInterrupt( TIMER_A0_BASE );                                 // Clear TA0IFG
    Timer_A_clearCaptureCompareInterrupt( TIMER_A0_BASE,
        TIMER_A_CAPTURECOMPARE_REGISTER_0                                         // Clear CCR0IFG


Not tested but should work.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...