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]

Register List

B. Register Setting

(RCC system clock)

  1. PLL, HCLK= 84MHz

(System Tick Configuration)

  1. Disable SysTick Timer

SysTick->CTRL ENABLE=0

  1. Choose clock signal: System clock or ref. clock(STCLK)

SysTick->CTRL CLKSOURCE = 0 or 1

  1. Choose to use Tick Interrupt (timer goes 1->0)

SysTick->CTRL TICKINT = 0 or 1

  1. Write reload Counting value (24-bit)

SysTick->LOAD RELOAD = (value-1)

  1. Start SysTick Timer

SysTick->CTRL ENABLE=1

  1. (option) Read or Clear current counting value

Read from SysTick->VAL

Write clears value

(NVIC Configuration)

  1. NVIC SysTick Interrupt priority

  2. 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\.

  • Download the template code

  • 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.h

  • Read the code definition for void delay_ms( ) in ecSysTick2.h

  • You can modify previous LAB code to include delay_ms()

Last updated

Was this helpful?