cancel
Showing results for 
Search instead for 
Did you mean: 

Combining Input Capture, One-Pulse Mode, and Reset Mode

dibs
Associate II
Posted on October 07, 2014 at 16:28

I am using an STM32F407xx.

My setup is that I have TIMa triggering TIMb. Here is a description of the behavior that I want:

TIMa:

Don't care. This part looks to be working in my application.

TIMb:

  1. When we get a Trig:
    1. Capture the current value of TIMb->CNT into CCR1
    2. Reset TIMb->CNT to 0.
    3. TIMb should start counting again from 0.
  2. If TIMb->CNT == TIMb->ARR,
    1. Stop Counting
    2. Fire an interrupt
    3. When we get another Trig:
      1. Capture TIMb->ARR into TIMb->CCR1
      2. Reset TIMb->CNT to 0
      3. TIMb should start counting again from 0.

How can I accomplish this?

Here is what I have found so far:

  1. Setting the TIMb trig source will allow it to react to TIMa
  2. Setting up CC1 as an input capture will allow the trigger to capture the current timer value
  3. Setting the TIMb in Reset slave mode will set TIMb->CNT = 0 every trigger
  4. I have been unable to get the stopping at TIMb->CNT == TIMb->ARR part to work
    1. My initial plan was to use the timer one-pulse mode
      1. I wanted this to do the timer stopping
      2. This does not appear to let the CC1 channel function properly
      3. I experimented with the URS and UDIS bits to no avail.

Any pointers here?

#reset #one-pulse #timers #stm32f4
0 REPLIES 0