cancel
Showing results for 
Search instead for 
Did you mean: 

Fast I/O handling

oleg23
Associate
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
4 REPLIES 4
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
Up vote any posts that you find helpful, it shows what's working..
frankmeyer9
Associate II
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 II
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
Associate
Posted on May 21, 2012 at 09:39

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