Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Arm Cortex STM32F405 Toggle pin at 20MHz?

Status
Not open for further replies.

btbass

Advanced Member level 5
Joined
Jul 20, 2001
Messages
1,896
Helped
438
Reputation
880
Reaction score
288
Trophy points
1,363
Location
Oberon
Activity points
12,887
I have a STM32F405 and I need to toggle an I/O pin at 20MHz.
Could anybody suggest how to do this?
Would inline assembler be the answer?
If so, how?
 

Which Compiler are you using ? You can use Timer to toggle the pin.
 

What is the maximum value of peripheral clock frequency?

What Oscillator frequency you have chosen ?

What is the minimum prescalar for Timer ?

- - - Updated - - -

Here is some example code, STM32F4: Timer

The timer can operate in the peripheral frequency of 168MHz, but obviously you can not use this code because it will have lot of delays when interpreting c to assembly, So you have to use PWM.
 

Thanks for the replies, I will look at the sample code.

I am using EmBlocks and the bare metal GCC compiler.
My core clock is 168MHz and the peripheral clock is 84MHz.

I have tried using the timer and also PWM.
The fastest I can go with these methods is ~2MHz?

Using C, if I just toggle the pin, I get < 2MHz.

while(1)
{
GPIO_SetBits(GPIOC, GPIO_Pin_12);
GPIO_ResetBits(GPIOC, GPIO_Pin_12);
}

I think I need inline assembler?
 

I will have a view on STM32F405 it look easy to do with PWM.

Doing with assembly will also difficult in case of 32 bit controllers.

So better you stick with PWM.

In LPC series you can generate 1/4 peripheral frequency, but still it will come like 164 / 8 = 20.5MHZ

Otherwise you have to select a peripheral frequency like 160MHz..

I will confirm the possibility after looking at manual.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top