Skip to main content
saimaddy123
Associate III
March 30, 2011
Question

Can I use a timer output to Toggle GPIO?

  • March 30, 2011
  • 4 replies
  • 873 views
Posted on March 30, 2011 at 07:07

Can I use a timer output to Toggle GPIO?

    This topic has been closed for replies.

    4 replies

    saimaddy123
    Associate III
    May 17, 2011
    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..

    Andrew Neil
    Super User
    May 17, 2011
    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?

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Nickname13136_O
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 14:30

    Hi,

    Yes, in this example there are four IOs toggleing.

    Tesla DeLorean
    Guru
    May 17, 2011
    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&TopicsView=https%3A%2F%2Fmy.st.com%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32VLDiscovery%2FAllItems.aspx&currentviews=419

    [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 (See Profile) Up vote any posts that you find helpful, it shows what's working..