cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use a timer output to Toggle GPIO?

saimaddy123
Associate II
Posted on March 30, 2011 at 07:07

Can I use a timer output to Toggle GPIO?

4 REPLIES 4
Andrew Neil
Chief II
Posted on May 17, 2011 at 14:30

''I saw ST examples and saw a OCToggle example in TIM examples.. Does that really do the same?''

 

Why do you doubt it?

Have you studied the example code?

Have you tried it?

Have you also looked at the Timebase example?

saimaddy123
Associate II
Posted on May 17, 2011 at 14:30

I doubt it because I was asking for the HW to automatically toggle it. This code uses the ISR to toggle the bits or whatever it wants to do. These examples enable Interrupts to do that. Even the timebase example uses ISR. I do not want any manual control over GPIOs. I would like to configure the timer and leave it to toggle the GPIO accordingly. May be i was not clear enough in my first post..

Posted on May 17, 2011 at 14:30

I, and others have posted several examples to the forum in recent memory. Admittedly it's a bit of a pig to search.

Both the timebase and pwm examples are a good starting point. You can control both period, and duty cycle (pulse width) easily. You don't need to have, or use, an update interrupt. You really wouldn't want to if the frequency was in the MHz.

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32VLDiscovery/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fSTM32VLDiscovery%2fExample%20PWM%20on%20STM32-Discovery%20Blue%20LED&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000491D59B8574F8049B5DFA3E8B21CBA51&TopicsVi...

[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32VLDiscovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32VLDiscovery/Example PWM on STM32-Discovery Blue LED&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000491D59B8574F8049B5DFA3E8B21CBA51&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32VLDiscovery/AllItems.aspx&currentviews=419]Here

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Nickname13136_O
Associate II
Posted on May 17, 2011 at 14:30

Hi,

Yes, in this example there are four IOs toggleing.