/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Interrupt handling

Username:     
Password:     
             

Forum

# 1   2009-03-12 13:55:46 Interrupt handling

Niceday
New member
Registered: 2009-03-06
Posts: 4

Interrupt handling

Hi,

I'm just started with the STM32. If i try to create 2 timers, only the first defined will create an interrupt:

<snip>
/* Enable the TIM2 Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQChannel;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
 
/* Enable the TIM3 Interrupt */
  NVIC_InitStructure.NVIC_IRQChannel = TIM3_IRQChannel;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
<snip>

In this construction the interrupt handler for TIM2 will called only. If you change the order and put the definition for TIM3 on top, only the interrupt handler of TIM3 will be called. From my understanding, both interrupt handlers should be called.
Could someone help with an solution?

Regards, Niceday

Offline

 

# 2   2009-03-16 07:49:04 Interrupt handling

Niceday
New member
Registered: 2009-03-06
Posts: 4

Re: Interrupt handling

Hi,

just found the reason for the not correct working interrupts. I forgot to clear the interrupt bit: i.e. TIM_ClearITPendingBit(TIM2, TIM_IT_Update).

Best regards
Niceday

Offline

 

Board footer