📚 Assignment 2 CMPE2250: Output Compare and Timer Interrupts
📋 Objective
- Configure hardware timers for precise output compare events, utilize timer interrupts, and scale update events using the Repetition Counter Register (RCR).
1️⃣ Part 1 - Output Compare Configuration
-
Configure the system clock to
50 MHz. -
Configure
TIM15to have a tick rate of100 ns. -
Generate two Output Compare (OC) events to automatically toggle the following pins:
-
CH1: Toggle
PC1every20 µs. -
CH2: Toggle
PC2every50 µs.
-
Note: The toggling must be handled automatically by the timer channel hardware, with the CCR values updated in the interrupt service routine to maintain the correct intervals.
2️⃣ Part 2: Update Interrupts and Pulse Width Analysis
-
Enable the Update Interrupt on TIM15.
-
In the interrupt handler, manually toggle
PA5when the update event occurs. -
Scope the signal on
PA5and determine its pulse width.
Deliverable:
-
Provide a screenshot of the oscilloscope capture with measurements.
-
Explain mathematically why this specific pulse width is obtained based on your timer configuration.
3️⃣ Part 3: Repetition Counter Register (RCR)
- Using the TIM15 Repetition Counter Register (
RCR), modify the update event configuration so that the PA5 pin toggles approximately every98 ms.
Deliverable:
- Explain your findings. How does the
RCRvalue relate to the new pulse width, and what value did you write to the register to achieve this timing?