/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Using interrupt without libraries!

Username:     
Password:     
             

Forum

# 1   2008-02-14 10:17:00 Using interrupt without libraries!

Boelskov
New member
Registered: 2008-02-13
Posts: 5

Using interrupt without libraries!

Hey

Can sombody explane how to use interrupt on a stm32 without using any libraries?? For example how du i handle the timer2 compare interrupt?
I have enablet the channel 4 compare interrupt, and the interrupt flag in TIM2_SR is set, but what to do now??

-Boelskov

Last edited by Boelskov (2008-02-14 10:17:51)

Offline

 

# 2   2008-02-14 11:03:51 Using interrupt without libraries!

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Using interrupt without libraries!

You can download the CircleOS V1.7 and analyze how the Timer2 interrupt is managed (see NVIC_Configuration in main.c). Now, CircleOS uses the STM32 library, but the related function are not so complex and you could "inline" the corresponding code.

Offline

 

# 3   2008-02-19 13:26:34 Using interrupt without libraries!

Boelskov
New member
Registered: 2008-02-13
Posts: 5

Re: Using interrupt without libraries!

I have used the startup file, and configurated NVIC_ENABLE0 and TIM1_DIER so the compare interrupt is enabled. It jumps to the right ISR, but even though the compare match comes fx every 2 sek, the ISR is run alle the time.
So it only runs in the ISR :-(

Do I need to clear the interrupt? or is it done by hardware?

Offline

 

# 4   2008-02-19 15:12:50 Using interrupt without libraries!

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Using interrupt without libraries!

See in the CircleOS project how the Timer2 interrupt is handled.

Offline

 

# 5   2008-02-20 07:25:41 Using interrupt without libraries!

Boelskov
New member
Registered: 2008-02-13
Posts: 5

Re: Using interrupt without libraries!

Hi

Now it works. What I did:

Before I leave the ISR, the interrupt flags are cleared (TIM1_SR) and the interrupt is reactivated (NVIC_ACTIVE0)

Do not know if it is the right way to do it, but it works, so I am happy :-D

Offline

 

Board footer