PreLAB: SysTick
Name:
ID:
I. Introduction
In this tutorial, we will learn how to use SysTick interrupt. We will create functions to count up numbers at a constant rate using SysTick.
The objectives of this tutorial are how to
Configure SysTick with NVIC
Create your own functions for the configuration of interrupts
Hardware
NUCLEO -F411RE
Software
VS code, CMSIS, EC_HAL
Documentation
II. Basics of SysTick
A. Register List
List of SysTick registers for this tutorial. [Programming Manual ch4.3, ch10.2]

B. Register Setting
(RCC system clock)
PLL, HCLK= 84MHz
(System Tick Configuration)
Disable SysTick Timer
SysTick->CTRL ENABLE=0
Choose clock signal: System clock or ref. clock(STCLK)
SysTick->CTRL CLKSOURCE = 0 or 1
Choose to use Tick Interrupt (timer goes 1->0)
SysTick->CTRL TICKINT = 0 or 1
Write reload Counting value (24-bit)
SysTick->LOAD RELOAD = (value-1)
Start SysTick Timer
SysTick->CTRL ENABLE=1
(option) Read or Clear current counting value
Read from SysTick->VAL
Write clears value
(NVIC Configuration)
NVIC SysTick Interrupt priority
NVIC SysTick Enable
III. Tutorial
A. Programming
This is an example code for turning the LED on/off with the button input trigger with a wait function.
Procedure
Name the project as ‘TU_SysTick’ by creating a new folder as ‘tutorial/TU_SysTick’
Download the header library files and save under
include\.ecSysTick2_student. ecSysTick2_student.c: Click here to downloadRename the files as
ecSysTick2. ecSysTick2.c
Download the template code
TU_SysTick_student.c: Click here to download
This is an example code for turning LED on/off with the button input trigger with a wait function.
Fill in the empty spaces in the code.
Run the program and check your result.
Your tutorial report must be submitted to the LMS
This is a sample program that turns LED on/off at 1 second period using SysTick
Example Code
Understand the code definition for void SysTick_init() : in
ecSysTick2.hRead the code definition for void delay_ms( ) in
ecSysTick2.hYou can modify previous LAB code to include delay_ms()
Last updated
Was this helpful?