AnsweredAssumed Answered

Setting up TIM2 with ISR

Question asked by vtshadow on Jan 14, 2014
Latest reply on Jan 14, 2014 by vtshadow

I am new to ARM and have been figuring out ways to set interrupts for certain peripherals that I have hooked to my board; however, I am having trouble understanding how to set up the vector interrupt table so it knows where to look for my ISR.

At the moment, I have configured Systick and I am using that for a delay function which works perfectly fine.

My interrupt vector table looks like the following:
         

My interrupt vector table looks like the following:
    ; --- Vector table definition
 
 .section ".cs3.interrupt_vector"
 
 .long  __cs3_stack                 /* Top of Stack                 */
 
 .long  Reset_Handler            
 
 .long  NMI_Handler               
 
 .long  HardFault_Handler         
 
 .long  MemManage_Handler          
 
 .long  BusFault_Handler         
 
 .long  UsageFault_Handler        
 
 .long  0                           /* Reserved                     */
 
 .long  0                           /* Reserved                     */
 
 .long  0                           /* Reserved                     */
 
 .long  0                           /* Reserved                     */
 
 .long  SVC_Handler               
 
 .long  DebugMon_Handler          
 
 .long  0                           /* Reserved                     */
 
 .long  PendSV_Handler           
 
 .long  SysTick_Handler
.long
...... all the way to
.long  TIM2_Handler                /* TIM2_Handler                 */  
      

I am trying to figure how to set TIM2 to create an interrupt which is then handled every 60Hz.
I've written the TIM2 initialization in assembly, but after reading the reference manual several times I am only sure of a few registers to set (CR1,CR2,DIER,CNT,PSC,ARR)...

Okay, excuse my rambling, but I am trying to ask:
          1) How do I set it so TIM2_Handler is called every 60 Hz?
          2) How does it know to call TIM2_Handler from the vector table when TIM2 sets an interrupt flag?


Outcomes