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.

  • Resolved

CCS/MSP-EXP432P401R: Issue with precise timing using TIMER_A module

Intellectual 1880 points

Replies: 2

Views: 123

Part Number: MSP-EXP432P401R

Tool/software: Code Composer Studio

Hi,

I'm trying to use the TIMER_A module on the MSP432R to generate a a pulse-position modulation signal for a servo. The period needs to be 50 Hz/20 ms. The source clock I'm using is SMCLK which is configured 3 MHz.  With clock divider set to 1 a period of 20 ms = 60,000 clock ticks. I then have the TIMER A module at the beginning of the period set the pin high and after 1 clock tick set the pin low using the toggle set configuration.

When probing the pins with a scope I noticed that that the period is around 19.86 ms instead of 20 ms. By playing around the timer period I am able to get close to 20 ms by using 60,421 clock ticks. Even that isn't 100% precise since the period is 19.99777 ms.

Any explanation on why the TIMER A module isn't outputting a period of exactly 20 ms?

Hardware: MSP-EXP432P401R

Code: Attached and based on the timer_a_upmode_gpio_toggle example from Resource Explorer.

SDK: SimpleLink MSP432P4 SDK v3.20.00.06

IDE: Code Composer Studio 8.2.0.000007

timer_a_example.zip

  • Please note that the period of the timer is always '+1' because there is an additional clock cycle when it roles over to zero.  

    Regards,

    Chris

  • The DCO accuracy is specified as +/-1.2% [Ref Data Sheet (SLAS826G) Table 5-12,] 60421/60000 is about 1.007, i.e. -0.7%, so it is within spec.

    To get better clock accuracy you'll need an external crystal.

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.