PSoC 4 Peripheral Driver Library - Alpha
SysTick (ARM System Timer)

General Description

Provides vendor-specific SysTick API.

The functions and other declarations used in this driver are in cy_systick.h. You can include cy_pdl.h (ModusToolbox only) to get access to all functions and declarations in the PDL.

The SysTick timer is part of the CPU. The timer is a down counter with a 24-bit reload/tick value that is clocked by the System clock or LF clock. The timer has the capability to generate an interrupt when the set number of ticks expires and the counter is reloaded. This interrupt is available as part of the Nested Vectored Interrupt Controller (NVIC) for service by the CPU and can be used for general-purpose timing control in user code.

The timer is independent of the CPU (except for the clock), which is useful in applications requiring precise timing that do not have a dedicated timer/counter available for the job.

Configuration Considerations

The Cy_SysTick_Init() performs all required driver's initialization and enables the timer. The function accepts two parameters: clock source cy_en_systick_clock_source_t and the timer interval. You must ensure the selected clock source for SysTick is enabled. The callbacks can be registered/unregistered any time after Cy_SysTick_Init() by calling Cy_SysTick_SetCallback().

Changing the SysTick clock source and/or its frequency will change the interrupt interval and therefore Cy_SysTick_SetReload() should be called to compensate for this change.

More Information

Refer to the SysTick section of the ARM reference guide for complete details on the registers and their use. See also the "CPU Subsystem (CPUSS)" chapter of the device technical reference manual (TRM).

MISRA-C Compliance

The SysTick driver has the following specific deviations:

MISRA Rule Rule Class (Required/Advisory) Rule Description Description of Deviation(s)
10.5 A The value of an expression should not be cast to an inappropriate essential type. This code is safe because value is checked before conversion to the enumeration.
10.8 R The value of a composite expression shall not be cast to a different essential type category or a wider essential type. This code is safe because value is checked before conversion to the enumeration.


VersionChangesReason for Change
1.0 Initial version

API Reference

 Data Structures