Skip to main content
hesam moshiri
Associate III
July 6, 2018
Solved

Speed Limit of the ''HAL_GPIO_TogglePin'' ?!!

  • July 6, 2018
  • 6 replies
  • 1522 views
Posted on July 06, 2018 at 16:28

The original post was too long to process during our migration. Please click on the attachment to read the original post.
    This topic has been closed for replies.
    Best answer by waclawek.jan
    Posted on July 06, 2018 at 16:44

    The interrupt service routine takes too long to execute, that's what limits the 'maximum frequency' here.

    This question is reocurring here quite often, e.g.

    https://community.st.com/0D50X00009XkW8YSAV

    JW

    6 replies

    Tesla DeLorean
    Guru
    July 6, 2018
    Posted on July 06, 2018 at 16:42

    Don't generate interrupts at this rate, you'll saturate the processor. The TIM provides ways to toggle or pulse pins into the 10's MHz

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    hesam moshiri
    Associate III
    July 6, 2018
    Posted on July 06, 2018 at 17:15

    the reason why I'm doing this because I want to generate pulses with a full control over their freq, duty and phase. the PWM can fix two of them but I could not find a satisfactory method to control the phase (in relation to another PWM signal)

    waclawek.jan
    Super User
    July 6, 2018
    Posted on July 06, 2018 at 17:47

    Use master-slave arrangement of timers to control phase.

    There are also the combined outputs in the newer STM32's timers, e.g. in L4.

    If you are desperate, 1MHz interrupt toggling a pin in a 'F4 might be viable, but only if you very well know what are you doing - and using Cube does not really indicate that.

    JW

    waclawek.jan
    waclawek.janBest answer
    Super User
    July 6, 2018
    Posted on July 06, 2018 at 16:44

    The interrupt service routine takes too long to execute, that's what limits the 'maximum frequency' here.

    This question is reocurring here quite often, e.g.

    https://community.st.com/0D50X00009XkW8YSAV

    JW