Posted on October 07, 2014 at 16:28I 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:
   - When we get a Trig:      
- Capture the current value of TIMb->CNT into CCR1
 - Reset TIMb->CNT to 0.
 - TIMb should start counting again from 0.
 
  - If TIMb->CNT == TIMb->ARR,      
- Stop Counting
 - Fire an interrupt
 - When we get another Trig:        
- Capture TIMb->ARR into TIMb->CCR1
 - Reset TIMb->CNT to 0
 - TIMb should start counting again from 0.
 
  
  
How can I accomplish this?
Here is what I have found so far:
    - Setting the TIMb trig source will allow it to react to TIMa
 - Setting up CC1 as an input capture will allow the trigger to capture the current timer value
 - Setting the TIMb in Reset slave mode will set TIMb->CNT = 0 every trigger
 - I have been unable to get the stopping at TIMb->CNT == TIMb->ARR part to work       
- My initial plan was to use the timer one-pulse mode         
- I wanted this to do the timer stopping
 - This does not appear to let the CC1 channel function properly
 - I experimented with the URS and UDIS bits to no avail.
 
  
  
Any pointers here?
    #reset #one-pulse #timers #stm32f4