Skip to main content
oleg23
Associate
May 15, 2012
Question

Fast I/O handling

  • May 15, 2012
  • 4 replies
  • 1030 views
Posted on May 15, 2012 at 11:57

Hi everyone,

I am using STM32F4 Discovery evaluation board and Atollic TrueStudio. My problem is a fast I/O handling i want to generate signal frequency at 84 MHz. I'm getting ~15 MHz if I use

while (1) {

GPIOD->BSRRH = GPIO_Pin_13;

GPIOD->BSRRL = GPIO_Pin_13;

}

How to achieve 84 MHz? Do I need to initialize the timer and pwm?

Thanks

 

#i/o-handling
    This topic has been closed for replies.

    4 replies

    Tesla DeLorean
    Guru
    May 15, 2012
    Posted on May 15, 2012 at 13:14

    I am using STM32F4 Discovery evaluation board and Atollic TrueStudio. My problem is a fast I/O handling i want to generate signal frequency at 84 MHz. I'm getting ~15 MHz if I use

     

     

    while (1) {

     

    GPIOD->BSRRH = GPIO_Pin_13;

     

    GPIOD->BSRRL = GPIO_Pin_13;

     

    }

     

     

    How to achieve 84 MHz? Do I need to initialize the timer and pwm?

    Seeing as how the APB access is going to take at least 4 cycle apiece writing to the GPIO pin is not going to be an efficient way to toggle the pin.

    For 84 MHz, you'd want to look at the MCO pins and configuration. Other frequencies can be generated via the timers, and will depend on your ability to factor the prescaler and period. ie integer multiples.

     
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    frankmeyer9
    Associate III
    May 15, 2012
    Posted on May 15, 2012 at 17:51

    And, you need to set the OSPEEDR register for the corresponding port to achieve that toggling speed at all. The default setting evaluates to 2 MHz.

    alok472
    Associate
    May 16, 2012
    Posted on May 16, 2012 at 15:17

    ''How to achieve 84 MHz? Do I need to initialize the timer and pwm?''

     

    Yes, pls use Timer. GPIOs switching is not a good idea. Moreover, you will not have time to execute other instructions if the code is only doing GPIO toggle.

    btw, 84Mhz is specif value. Why do you need this freq ?

    oleg23
    oleg23Author
    Associate
    May 21, 2012
    Posted on May 21, 2012 at 09:39

    Thank you to all for your answers. I want to test the limits of this board