Assignment #2: Output Compare and Timer Interrupts

📚 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 TIM15 to have a tick rate of 100 ns.

  • Generate two Output Compare (OC) events to automatically toggle the following pins:

    • CH1: Toggle PC1 every 20 µs.

    • CH2: Toggle PC2 every 50 µ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 PA5 when the update event occurs.

  • Scope the signal on PA5 and 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 every 98 ms.

Deliverable:

  • Explain your findings. How does the RCR value relate to the new pulse width, and what value did you write to the register to achieve this timing?