Functions
SysTick

Module used to configure/control the Cortex M4 SysTick. More...

Functions

void SysTick_enableModule (void)
 
void SysTick_disableModule (void)
 
void SysTick_registerInterrupt (void(*intHandler)(void))
 
void SysTick_unregisterInterrupt (void)
 
void SysTick_enableInterrupt (void)
 
void SysTick_disableInterrupt (void)
 
void SysTick_setPeriod (uint32_t period)
 
uint32_t SysTick_getPeriod (void)
 
uint32_t SysTick_getValue (void)
 

Detailed Description

Module used to configure/control the Cortex M4 SysTick.


Module Operation


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.


Programming Example


The DriverLib package contains a variety of different code examples that demonstrate the usage of the SysTick module. These code examples are accessible under the examples/ folder of the SDK release as well as through TI Resource Explorer if using Code Composer Studio. These code examples provide a comprehensive list of use cases as well as practical applications involving each module.

Below is a very brief code example showing how to configure the SysTick module to interrupt periodically and blink an LED attached to P1.0.

Function Documentation

void SysTick_enableModule ( 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 SysTick_setPeriod(). 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.
void SysTick_disableModule ( 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.
void SysTick_registerInterrupt ( void(*)(void)  intHandler)

Registers an interrupt handler for the SysTick interrupt.

Parameters
intHandleris 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
Interrupt_registerInterrupt() for important information about registering interrupt handlers.
Returns
None.

References FAULT_SYSTICK, and Interrupt_registerInterrupt().

void SysTick_unregisterInterrupt ( void  )

Unregisters the interrupt handler for the SysTick interrupt.

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

See Also
Interrupt_registerInterrupt() for important information about registering interrupt handlers.
Returns
None.

References FAULT_SYSTICK, and Interrupt_unregisterInterrupt().

void SysTick_enableInterrupt ( 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.
void SysTick_disableInterrupt ( void  )

Disables the SysTick interrupt.

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

Returns
None.
void SysTick_setPeriod ( uint32_t  period)

Sets the period of the SysTick counter.

Parameters
periodis 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 period supplied here on the next clock after SysTick is enabled.
Returns
None.

References ASSERT.

uint32_t SysTick_getPeriod ( 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.
uint32_t SysTick_getValue ( 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.

Copyright 2018, Texas Instruments Incorporated