2014-01-13 03:52 PM
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?
2014-01-13 04:40 PM
It might help to specify the chip, and the frequency it is running at.
The interrupt/peripheral association is hard wired via the NVIC, you will need to configure/enable the NVIC. If you have a 72 MHz clock 72000000 / 60 = 1200000 12000 * 100 = 1200000 (Factoring) Set the Prescaler to 100 - 1 (PSC) Set the Period to 12000 - 1 (ARR)2014-01-13 06:38 PM
Got it to work, thank you for the advice!