The speed of GPIO of a stm32 chip is set by register of OSPEEDR. It shows:

  • 00: Low speed
  • 01: Medium speed
  • 10: Fast speed (50MHz in library)
  • 11: High speed (100MHz in library)

My guess is that the speed is not related with the system clocks(AHB1) at all. It is just the physical property of the GPIO pin itself. Am I correct? Is it done by varying the output resistance of the pin or something?

The datasheet could be found here: http://www.st.com/stonline/stappl/resourceSelector/app?page=fullResourceSelector&doctype=datasheet&LineID=11

  • 2
    \$\begingroup\$ If you could post a link to the datasheet, there might be an explanation or hint in there. \$\endgroup\$ – pjc50 May 29 '14 at 8:32
  • \$\begingroup\$ Which chip? Why this question is important for you? \$\endgroup\$ – Roh May 29 '14 at 11:08
  • \$\begingroup\$ @pjc50 Thanks for you remind! I have updated the information. \$\endgroup\$ – richieqianle May 29 '14 at 11:56
  • \$\begingroup\$ @Poh I am using STM32F407. And I think this question is a kind of general. The answer is not for specific application or anything. Just curious about the chip structure. \$\endgroup\$ – richieqianle May 29 '14 at 11:57

Generally this is done by having multiple different drivers for the line, of different sizes and therefore with varying output impedance. Recall the basic CMOS driver:


simulate this circuit – Schematic created using CircuitLab

Making the transistors larger increases their drive strength and lowers their on-resistance, but requires more charge to be moved on and off the gate when changing state. That results in increased power consumption.

  • \$\begingroup\$ Thanks for your reply! Do you mean when the speed is higher, more power will be consumed? And when will transistor M2 be conductive? It seems that IN can not be lower than 0V and it will never be conductive... \$\endgroup\$ – richieqianle May 30 '14 at 1:55
  • \$\begingroup\$ M2 is supposed to be NMOS, which will conduct when IN is positive. Have I got the diagram wrong? \$\endgroup\$ – pjc50 May 30 '14 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.