2024 FALL ELEC335 LAB3 - STD
2024 FALL ELEC335 LAB3 - STD
1 Overview
This lab emphasizes the importance of using interrupts and timers in various
microcontroller tasks and ensures students can effectively implement and manage
time-based events in embedded systems.
2 STM32F103C8T6 SETUP
The STM32F103C8T6 board is a blue chip, supports arduino ide and there are lots of
resource and tutorial videos about. It's also cheap compared to other boards!
0
Problems
Problem 1. In this problem, you will work on creating an accurate delay function
using “SysTick” exception. Create a “SysTick” exception with 1 millisecond
interrupt intervals. Then create a “delay_ms(..)” function that will accurately
wait for (blocking) given number of milliseconds.
• How would you measure the accuracy of your delay using software
methods?
• How would you measure the accuracy of your delay using hardware
methods?
Explain each case, and (if possible) implement your solution.
Problem 2. In this problem, you will work with general purpose timers. Set up
a timer with lowest priority that will be used to toggle on-board LED at 1 second
intervals. Change the blinking speed using an external button. Each button press
should increase the blinking speed by 1 second up to a maximum of 10 seconds.
Next button press after 10 should revert it back to 1 second. All the functionality
should be inside your interrupts.
Note: Arrange it so that the LSD of the number increments in 1 second intervals.
(i.e it should take 10 seconds to go from 0000 to 9999)
Problem 4. In this problem, you will work with watchdog timers. Setup either
window or independent watchdog timer and observe its behavior in the simple
blinky example from the repo. Calculate the appropriate reset time and
implement it. Add the necessary handler routine for resetting the device.
Problem 5. In this problem, you will implement your watchdog timer in Problem
3. Figure out a way to properly incorporate it to your code when it all works with
timers. Explain your solution and implementation and make sure you covered
all possible scenarios.
1
Submission
● Send the source code and .elf file to the Teams group. Zipped with name
F2024EC335_studentNumber_lab1.rar
_studentNumber_lab1/
problem1/
problem1.s problem1.elf
problem2/
problem2.s problem2.elf ..
● Bring your breadboard setup of the last problem to class and show us all how it works!
● Write a report in the following format:
○ Explain key parts of your code.
○ What you learned.
○ Proper cover page, intro, problems, flow charts, block diagrams, schematic diagrams,
comments, and theoretical, mathematical work, simulation vs. The lab report must be
submitted in hard copy.
● You will answer some key questions during the lab session. So be prepared and don’t cheat.
There is a possibility that these subjects will become your profession.