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.

RTOS/MSP432P401R: Confused by Timer Module using SYSTICK

Part Number: MSP432P401R
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi all,

At the moment, I don't have the Timestamp module enabled in my project and as you can see from the Outline below, I have the HAL and MSP432 Timer modules enabled.

My .cfg file confirms this setting:

var Timer = xdc.useModule('ti.sysbios.hal.Timer');
var ti_sysbios_family_arm_msp432_Timer = xdc.useModule('ti.sysbios.family.arm.msp432.Timer');

[no mention of TimeStamp in my .cfg file!]

However, if I look in ROV (see below) I'm told that I have the MSP432 and M3 Timer modules enabled.  Which seems strange given that I haven't asked for an M3 Timer module.  What is more strange is that the M3 timer module appears to by associating the TimeStamp module (which is NOT enabled!) to the SysTick peripheral (and indeed when I look at the Systick registers, the module seems to have been configured and enabled). 

I would like to use SYSTick for myself. 

Is there a way to make RTOS let SYSTick go? 

Cheers

Julian

I

  • Julian,

    The Outline view shows you which modules have been explicitly imported into the configuration by your configuration script. This is a view before you build your program. If you happen to import two modules from different packages but which have the same module name (e.g. Timer), then the Outline view will decorate the module name with the package name to distinguish them.

    When you build your program, the configuration phase might import additional modules as needed. This is what ROV will show you; all the actual modules used when building your program. For example, if your program will be using the ti.sysbios.hal.Timer module, you should add only this module to your configuration script. The device specific delegate will be added automatically.

    Looking at your ROV view, it seems that someone explicitly added the ti.sysbios.family.arm.m3.Timer module. Check your configuration script to see if it is in there by mistake. I don't get this module when I try to reproduce your situation.

    Finally, the ROV Viewable Modules list shows only modules with a custom display tab. Look under All Module to see modules which have only the default display tab (Raw).

    What SDK are you using?

    ~Ramsey

  • G'Day Ramsey,

    I've attached my .cfg file so you can take a look.  I don't think I've explicitly added the arm.m3 timer, but I have added the m3 HWIs.  I'd appreciate if you could take a look to see if I've done something wrong. 

    I now understand that during build additional modules may be added where necessary, so the Outline View and ROV won't necessarily match.  Can you see anything in my .cfg file that may have caused m3 timers to appear for me?  

    I've taken a look down into the "All Modules" section of ROV and I see both MSP432 and M3 timers down there too.

    I'm using TI-RTOS 2.20.00.06, haven't moved over to SimpleLink yet.    Using CCS v7.0.0

    Cheers

    Julian

    5344.Project.cfg

  • Julian,

    In your config script, I see that you have enabled logging. The logger requires a timestamp; so, it pulls in this module. The timestamp module requires a timestamp provider. By default, it will use the one from the ti.sysbios.family.arm.m3 package. Finally, the timestamp provider needs a timer; it uses the timer from the same package which uses the SysTick peripheral.

    LoggingSetup                    (ti.uia.sysbios)
    +-- LoggerStopMode              (ti.uia.loggers)
        +-- Timestamp               (xdc.runtime)
            +-- TimestampProvider   (ti.sysbios.family.arm.m3)
                +-- Timer           (ti.sysbios.family.arm.m3)
                    +-- SysTick     (peripheral)

    However, if you configure the timestamp provider yourself, then it will be used in preference. There are two ways to do this. You can tell the timestamp provider to use the same timer used by the BIOS Clock module, or you can use a dedicated timer.

    /* use same timer as BIOS Clock */
    var Timestamp = xdc.useModule('xdc.runtime.Timestamp');
    var TimestampProvider = xdc.useModule('ti.sysbios.family.arm.msp432.TimestampProvider');
    
    TimestampProvider.useClockTimer = true;
    Timestamp.SupportProxy = TimestampProvider;

    The bummer here is that this timer runs slow; 32768Hz. You will notice that your timestamp in the log events ticks slowly. But you can use a dedicated timer and driver it with the SMCLK which runs at 12MHz to get a high-resolution timestamp.

    If you take this approach, you must be careful not to use a timer which is reserved by the TI-RTOS drivers. For example, I used the PWM driver example to debug this issue. In the board file (MSP_EXP432P401R.c) of this example, it is using Timer_A1. You must remove this timer from the available timer mask.

    /* PWM is using Timer_A1, remove it from the available timers mask */
    var ti_sysbios_family_arm_msp432_Timer = xdc.useModule('ti.sysbios.family.arm.msp432.Timer');
    ti_sysbios_family_arm_msp432_Timer.anyMask = 0xd;
    
    /* use a dedicated timer with 12MHz input clock */
    var Timestamp = xdc.useModule('xdc.runtime.Timestamp');
    var TimestampProvider = xdc.useModule('ti.sysbios.family.arm.msp432.TimestampProvider');
    
    TimestampProvider.useClockTimer = false;
    TimestampProvider.clockSource = TimestampProvider.Source_SMCLK;
    Timestamp.SupportProxy = TimestampProvider;

    Now you have a high-resolution timestamp in your log events. But the bummer here is that the timer, which has only a 16-bit counter, will roll over every 5.5 ms. This causes an interrupt to fire. This could have a negative impact on battery life.

    It might be possible to slow down the timer to minimize power consumption. You would use the Timer module to create an instance and specify the input divider: Timer.ID_8. This would increase the rollover period to about 44 ms. Specify the actual timer ID in your timestamp provider. I've not tried this.

    I have attached my project which is using your config script. Change the if-statement to switch between the two timers. Look at the end of the config script (Julian.cfg).

    4011.pwmled_logging.zip

    BTW, when using ROV to inspect the Timer module, the Device Name is incorrect. Use the Device Id and the Device Address to cross reference the actual timer. I have reported this issue.

    ~Ramsey

  • Ah ha!

    I've come full circle!  

    The reason I wanted SysTick for myself was because I was unhappy with TimeStamp apparently being stuck using TimerA peripherals when things like SysTick and Timer32 are much better suited for the job.

    There is nothing in the GUI to suggest that TimerStamp (or the TimeStampProviders) use anything other than a TimerA.  The only place I see mention that the M3 / MSP432 TimeStampProvider will use SysTick is in the CDOC.

    This is all I see for TimeStamp configuration.  The "Device-specific Timestamp support" link just takes me to the properites table of the TimeStamp moulde.

    If I then go and add an M3 or MSP432 TimeStampProvider (both exist but seem to be identical) I get this screen

    Which only appears to allow TimerStamp to run off the TimerA peripherals. 

    How do I set this screen up to ensure I get SysTick as the TimeStampProvider?

    Cheers

    Julian

  • Julian,

    You are correct. In the XGCONF editor, there is no indicator of how the logger, timestamp, and timestamp provider modules are connected. This is unfortunate and unlikely to improve. The configuration model is very rich in features, and it is very difficult to express this in a GUI. In these situations, you will have to use the script text editor and ROV to fully configure the model.

    Here are some tips which might help.

    In ROV, select the Clock module. Click on the Module tab. Note the timerHandle value, 0x20001b80 in my case. This does not tell you which timer module it is using, but the handle will always be unique at the system level. If you inspect the two timer modules, you will see the above address is owned by the ti.sysbios.family.arm.msp432.Timer module. Use the address column.

    You can also look at the Clock's Raw tab. Open up the following property:

    Clock > Raw
    Configuration > TimerProxy
    $name = ti.sysbios.family.arm.msp432.Timer

    This confirms that the Clock module is using the MSP432 Timer module.

    A similar technique can be used to track down the timestamp source. Start by looking at the Timestamp module.

    xdc.runtime.Timestamp > Raw
    Configuration > SupportProxy
    $name = ti.sysbios.family.arm.m3.TimestampProvider

    If you happen to have more than one TimestampProvider in your system, this will tell you which one is actually being used.

    Now inspect the TimestampProvider to determine which tick source is in use.

    ti.sysbios.family.arm.m3.TimestampProvider > Raw
    Module State
    timer = 0x20001d28

    Use the timer address to determine which module owns it. In my example, it is the ti.sysbios.family.arm.m3.Timer module. Inspecting this module indicates that the actual timer source is the SysTick peripheral.

    ti.sysbios.family.arm.m3.Timer > Device
    device = SysTick
    devAddr = 0xe000e010

    So, in this example, the SysTick is used for the logging timestamp and Timer_A0 is used for the BIOS Clock. I realize this requires knowledge of how the modules are implemented. I would not expect the community members to know this. But its the best I can offer at this time.

    ~Ramsey 

  • Thank you Ramsey!