Someone here who works with the IAR Embedded Workbench for ARM? I am stuck with this code, the interrupt function is never called:
#include "stm32f10x.h"
void TIM2_IRQHandler (void) {
TIM2->SR &=~TIM_SR_UIF;
GPIOC->ODR |= GPIO_ODR_ODR13;
}
void timer2_setup() {
RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;
TIM2->PSC = 0;
TIM2->ARR = 900;
TIM2->DIER |= TIM_DIER_UIE;
NVIC_EnableIRQ(TIM2_IRQn);
TIM2->CR1 = TIM_CR1_CEN;
}
int main()
{
/* Set System-Clock as high as possible */
RCC->CFGR = RCC_CFGR_SW_1 | RCC_CFGR_PLLMULL_3 | RCC_CFGR_PLLMULL_2 | RCC_CFGR_PLLMULL_0;
RCC->CR = RCC_CR_HSION | RCC_CR_PLLON;
/* Set GPIO C13 as High-Speed PushPull output */
RCC->APB2ENR = RCC_APB2ENR_IOPCEN;
GPIOC->CRH |= GPIO_CRH_MODE13_1 | GPIO_CRH_MODE13_0;
__enable_irq();
timer2_setup();
GPIOC->ODR &=~GPIO_ODR_ODR13;
while(1){
asm volatile ("nop");
}
}
There has to be a certain way how to define interrupt functions in IAR, I just didn't find it yet.