cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F100C4, TIM1 problem

lettenhof
Associate
Posted on December 16, 2012 at 20:19

Hello!

I've faced with next challenge: my STM32F100C4 freezes right after TIM1 interruption occurs. When I used simulator of Keil (this MCU isn't supported by simulator, so I specified STM32F103C8) I found place in startup file where program freezes:

startup_stm32f10x_ld_vl.s

<...>

; Dummy Exception Handlers (infinite loops which can be modified)

 

<...>

Default_Handler PROC

                ...

                EXPORT  %name of the peripheria interrupt handler%    [WEAK]

                ...

<...list of the interrupt names...>

                B       .         <-- this label

 

                ENDP

 

                ALIGN

Unfortunately, I still don't have any in-circuit debugger so I can diagnose something with one LED flashing or simulation result.

What can be a cause of this freezing?

#stm32f100c4-tim1
6 REPLIES 6
zzdz2
Associate II
Posted on December 16, 2012 at 21:07

I think you use default handler, ''b .'' may be just infinite loop like ''while(1);''

You need to write your handler to service the irq.

Posted on December 16, 2012 at 21:10

What can be a cause of this freezing?

One might guess that you don't have a suitably named interrupt hander for the timer interrupt. Either misspelled, or using a C++ compiler?

Or that the system in hard faulting and ending up in the while(1) loop.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
lettenhof
Associate
Posted on December 18, 2012 at 04:42

knik, handler which I needed is declared and defined...

clive1, I think the name is correct. First time I had written wrong handler name - but compilator cried about error. After that I copied the handler name from an appropriate header file of Keil.

BTW, I remembered that one time I've tried to use TIM6 instead of TIM1 - and got this freezing again. Its handler is coupled with another peripherial handler - like TIM1 handler (TIM1 - witn TIM16, TIM6 - with DAC). Maybe the root of the problem is there?

frankmeyer9
Associate II
Posted on December 18, 2012 at 10:49

Or, you might have missed to reset the pending flag in the timer interrupt.

This could freeze your application, too.

zzdz2
Associate II
Posted on December 18, 2012 at 11:23

Try to check if any vector points to the ''b .'' which is an infinite loop.

It may be default handler or hard fault handler.

Also note that TIM1 uses four different vectors.

Posted on December 18, 2012 at 15:38

                DCD     TIM1_BRK_IRQHandler        ; TIM1 Break

                DCD     TIM1_UP_IRQHandler         ; TIM1 Update

                DCD     TIM1_TRG_COM_IRQHandler    ; TIM1 Trigger and Commutation

                DCD     TIM1_CC_IRQHandler         ; TIM1 Capture Compare

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..