Multiple timers problem

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
midihenry
Posts: 13
Joined: Sun Oct 13, 2013 12:51 pm

Multiple timers problem

Post by midihenry »

Hello,

I'm building a line-following robot that also avoids obstacles. So, I wanted to use an ultra-sound sensor mounted on a servomotor to check for the obstacles. However, i encountered a problem when trying to assign 4 timers: 1 for the motors TIM4 (pwm output), 1 for the servomotor (pwm output), and 2 for the ultra-sound sensor(icu and pwm output).
I couldn't get the timers 1,2 and 8 to work along with the timers 3,4 and 5.
Could someone please tell me if there is something that I missed because I'm really stuck...

Thank you in advance
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: Multiple timers problem

Post by Tectu »

Probably you could give some more information? For example, we don't know what MCU you are using. Furthermore, please describe the problem you are having. We don't know where what exactly failed.


~ Tectu
midihenry
Posts: 13
Joined: Sun Oct 13, 2013 12:51 pm

Re: Multiple timers problem

Post by midihenry »

Well I'm using the STM32 F4 Discovery board using chibios 2.4.2
I need to configure 4 timers but I could only use 3 at a time.
User avatar
Tectu
Posts: 1225
Joined: Thu May 10, 2012 9:50 am

Re: Multiple timers problem

Post by Tectu »

What exactly happened? By "could just use three at a time", do you mean that you got some compiler error? Did all of them stopped working once you added a fourth or did the three keep running and the others didn't start up?
Could you also please provide us with some of your code.


~ Tectu
midihenry
Posts: 13
Joined: Sun Oct 13, 2013 12:51 pm

Re: Multiple timers problem

Post by midihenry »

It wasn't a compiler error it's just that timers 1,2 and 8 wouldn't work for me even when I tried to use them one at a time.
They wouldn't give me any output..
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Multiple timers problem

Post by Giovanni »

Are timer callbacks being invoked? you could place breakpoints. If callbacks are invoked but you just don't see output PWM signals then it could be a pin conflict or a pin setup problem, you have to assign the correct alternate function to pins (see datasheet, not reference manual).

Giovanni
Post Reply