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.

MSPM0G3507: Need example of how to read accumulated ticks between Timer Interrupts on MSP M0 series.

Part Number: MSPM0G3507


I copied this code from a TIMER-CAPTURE example:  unsigned long ctrTicks = DL_Timer_getCaptureCompareValue(TIMER_CAP_INST, DL_TIMER_CC_0_INDEX); where it worked when called from inside of the interrupt for that timer.       When trying to apply it to a general purpose timer where I am trying to read the ticks accumulated between events I  am always getting a zero.      I need an example showing how to read read accumulated ticks between interrupts.   I want to be able to use that to compute a more accurate time by Adding the acumulatedTicks * 0.25  to the  counter I am already keeping for the 2us events.


The code above OK for TIMER-CAPTURE but is not working for a general TIMER. The general timer is currently configured against BUSCLK with divider of 1 and prescaler of 8 which yields a 250ns basic tick. I have the timer down counting generating an interrupt every 2 us which is working OK.   I get a separate interrupt for a GPIO pin change and want to take the accumulated counter from the counter and add it to the counter we are currently tracking at resolution of 2 us. eg: double adjTimeCtr = usCntr + (ctrTicks * 0.25)

I don't want to use a capture timer for this because I am running short of resources when porting to a MSP0L1306.

I think I must be using the wrong value for DL_TIMER_CC_0_INDEX but don't know what the correct value is.

Can somebody provide a link to detailed explanations of all the functions like DL_Timer_getCaptureCompareValue along with all the constants and their purpose for each parameter.

  • Hi Joseph,

    If you wanted to get the value of a general timer (not set to capture and compare) you can call the DL_TimerG_getTimerCount(TIMER_INSTANCE); function.

    For details on the functions, when you build the project in Code Composer studio, you can do ctrl+left click on the function to go into the function's definition.

    For functions, #defines, structs, etc. you can ctrl + left click to go into the definition/declarations. You can also follow the general DriverLib naming scheme and do ctrl+ space to get the auto-complete function. This is beneficial to see the variety of functions or #defines you can utilize.

    If you prefer the documentation approach all the DriverLibs APIs can be found in the SDK under the docs folder or in resource explorer

    Regards,
    Luke