MSP432E4 DriverLib API Guide  1.11.00.03
Functions
Systick_api

Functions

void SysTickEnable (void)
 
void SysTickDisable (void)
 
void SysTickIntRegister (void(*pfnHandler)(void))
 
void SysTickIntUnregister (void)
 
void SysTickIntEnable (void)
 
void SysTickIntDisable (void)
 
void SysTickPeriodSet (uint32_t ui32Period)
 
uint32_t SysTickPeriodGet (void)
 
uint32_t SysTickValueGet (void)
 

Detailed Description

Introduction

SysTick is a simple timer that is part of the NVIC controller in the Cortex-M microprocessor. Its intended purpose is to provide a periodic interrupt for an RTOS, but it can be used for other simple timing purposes.

The SysTick interrupt handler does not need to clear the SysTick interrupt source as it is cleared automatically by the NVIC when the SysTick interrupt handler is called.

API Functions

The SysTick API is fairly simple, like SysTick itself. There are functions for configuring and enabling SysTick (SysTickEnable(), SysTickDisable(), SysTickPeriodSet(), SysTickPeriodGet(), and SysTickValueGet()) and functions for dealing with an interrupt handler for SysTick (SysTickIntRegister(), SysTickIntUnregister(), SysTickIntEnable(), and SysTickIntDisable()).

Programming Example

The following example shows how to use the SysTick API to configure the SysTick counter and read its value.

uint32_t ui32Value;
//
// Configure and enable the SysTick counter.
//
//
// Delay for some time...
//
//
// Read the current SysTick value.
//
ui32Value = SysTickValueGet();

Function Documentation

§ SysTickEnable()

void SysTickEnable ( void  )

Enables the SysTick counter.

This function starts the SysTick counter. If an interrupt handler has been registered, it is called when the SysTick counter rolls over.

Note
Calling this function causes the SysTick counter to (re)commence counting from its current value. The counter is not automatically reloaded with the period as specified in a previous call to SysTickPeriodSet(). If an immediate reload is required, the NVIC_ST_CURRENT register must be written to force the reload. Any write to this register clears the SysTick counter to 0 and causes a reload with the supplied period on the next clock.
Returns
None.

References HWREG, NVIC_ST_CTRL, NVIC_ST_CTRL_CLK_SRC, and NVIC_ST_CTRL_ENABLE.

§ SysTickDisable()

void SysTickDisable ( void  )

Disables the SysTick counter.

This function stops the SysTick counter. If an interrupt handler has been registered, it is not called until SysTick is restarted.

Returns
None.

References HWREG, NVIC_ST_CTRL, and NVIC_ST_CTRL_ENABLE.

§ SysTickIntRegister()

void SysTickIntRegister ( void(*)(void)  pfnHandler)

Registers an interrupt handler for the SysTick interrupt.

Parameters
pfnHandleris a pointer to the function to be called when the SysTick interrupt occurs.

This function registers the handler to be called when a SysTick interrupt occurs.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

References FAULT_SYSTICK, HWREG, IntRegister(), NVIC_ST_CTRL, and NVIC_ST_CTRL_INTEN.

§ SysTickIntUnregister()

void SysTickIntUnregister ( void  )

Unregisters the interrupt handler for the SysTick interrupt.

This function unregisters the handler to be called when a SysTick interrupt occurs.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

References FAULT_SYSTICK, HWREG, IntUnregister(), NVIC_ST_CTRL, and NVIC_ST_CTRL_INTEN.

§ SysTickIntEnable()

void SysTickIntEnable ( void  )

Enables the SysTick interrupt.

This function enables the SysTick interrupt, allowing it to be reflected to the processor.

Note
The SysTick interrupt handler is not required to clear the SysTick interrupt source because it is cleared automatically by the NVIC when the interrupt handler is called.
Returns
None.

References HWREG, NVIC_ST_CTRL, and NVIC_ST_CTRL_INTEN.

§ SysTickIntDisable()

void SysTickIntDisable ( void  )

Disables the SysTick interrupt.

This function disables the SysTick interrupt, preventing it from being reflected to the processor.

Returns
None.

References HWREG, NVIC_ST_CTRL, and NVIC_ST_CTRL_INTEN.

§ SysTickPeriodSet()

void SysTickPeriodSet ( uint32_t  ui32Period)

Sets the period of the SysTick counter.

Parameters
ui32Periodis the number of clock ticks in each period of the SysTick counter and must be between 1 and 16,777,216, inclusive.

This function sets the rate at which the SysTick counter wraps, which equates to the number of processor clocks between interrupts.

Note
Calling this function does not cause the SysTick counter to reload immediately. If an immediate reload is required, the NVIC_ST_CURRENT register must be written. Any write to this register clears the SysTick counter to 0 and causes a reload with the ui32Period supplied here on the next clock after SysTick is enabled.
Returns
None.

References ASSERT, HWREG, and NVIC_ST_RELOAD.

§ SysTickPeriodGet()

uint32_t SysTickPeriodGet ( void  )

Gets the period of the SysTick counter.

This function returns the rate at which the SysTick counter wraps, which equates to the number of processor clocks between interrupts.

Returns
Returns the period of the SysTick counter.

References HWREG, and NVIC_ST_RELOAD.

§ SysTickValueGet()

uint32_t SysTickValueGet ( void  )

Gets the current value of the SysTick counter.

This function returns the current value of the SysTick counter, which is a value between the period - 1 and zero, inclusive.

Returns
Returns the current value of the SysTick counter.

References HWREG, and NVIC_ST_CURRENT.

© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale