cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with timer capture interrupts for STR912 microcontroller...

lvenkin
Associate II
Posted on November 02, 2008 at 09:49

Trouble with timer capture interrupts for STR912 microcontroller...

5 REPLIES 5
daniel8
Associate II
Posted on May 17, 2011 at 09:56

In your code, when you define GPIO6, you specify pins 0 and 2 as being timer capture inputs.

Pin 0 is indeed TIM0_ICAP1, but pin 2 is TIM1_ICAP1 , and not TIM2_ICAP1

you need to change it to pins 0 and 4 to make it work.

Daniel

lvenkin
Associate II
Posted on May 17, 2011 at 09:56

I use interrupt Capture_1 for timer TIM0, and all interrupts work succesfully; all OK.

But if I try to use interrupts Capture_1 and Capture_2 for timer TIM1 (Tim2), it doesn't work.

For example: see attached file!

What I do wrong?,

who can help me?

daniel8
Associate II
Posted on May 17, 2011 at 09:56

In your code, when you define GPIO6, you specify pins 0 and 2 as being timer capture inputs.

Pin 0 is indeed TIM0_ICAP1, but pin 2 is TIM1_ICAP1 , and not TIM2_ICAP1

you need to change it to pins 0 and 4 to make it work.

Daniel

lvenkin
Associate II
Posted on May 17, 2011 at 09:56

Thank you!!!

But my trouble doesn't solved...

I try to set

Code:

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_4;

GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;

GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull;

GPIO_InitStructure.GPIO_IPInputConnected = GPIO_IPInputConnected_Enable;

GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1;

but timers don't work in capture mode properly.

What I do wrong?

Who can help me, please!

dhoyen
Associate II
Posted on May 17, 2011 at 09:56

Hi,

If my memory is good (TBC), i had this trouble this is a BUG

in the ST library:

The previous interrupt is disabled before you install a second (), look the code in the timer, this bug is in the 91x_tim.c. Add a breakpoint and you should look your register is reseted before add a new interrupt, you will lost possibility to fire the previous.

Sorry for the lack of detail, but i repply from my personnel computer, i haven't access to my project

Good luck.

Damien HOYEN