2026-04-22 5:40 AM - last edited on 2026-04-23 9:19 AM by KDJEM.1
:warning:Note: The internal GPIO structure has been simplified for better conceptual understanding. (Components such as
ESD protection diodes, pull-up and pull-down resistors, etc., are not shown.)
:warning:Warning / Disclaimer This analysis is based on my personal study and interpretation of technical documents. Therefore, I cannot guarantee that it fully represents the actual internal behavior of all STM32 microcontrollers. This is a simplified conceptual model for educational purposes.
INTRODUCTION
In this document, we will examine how our code affects GPIO units at the MOSFET level. Our analysis focuses on the MOSFET switching logic in General Purpose Output (Push-Pull, Open-Drain) and Input Mode (Analog and Alternate Function modes are not included in this analysis). I used the following documents as references for this analysis and the visuals:
Since this analysis is based on the STM32 architecture, we will focus on MODER, OTYPER, and ODR registers.
I would be very happy if ST employees or experienced engineers could check my work. Please let me know if you find any mistakes or if there is anything I can improve. I am eager to learn from your feedback!
How to read the table?
Register Selection: Select MODER, OTYPER, and ODR values in order.
Output Control: The Output Controller sends the resulting Signal 1 and Signal 2 to the MOSFET Gates.
Note: "X" indicates that the selection is not available or has no effect for that mode.
PIN MODES
1. OUTPUT MODE
1.1 What is Push-pull?
Briefly, it is a MOSFET pair that forces the line to a specific logic level. It is easier to understand with an example:
1.2 What is Open-drain?
Briefly, the PMOS is always OFF (cut-off). Only the NMOS switches between ON and OFF states. This is why we use this mode for I2C. As you may remember, in I2C, the line is either released (floats/HIGH with pull-up) or pulled LOW.
2. INPUT MODE
In input mode, both MOSFETs (PMOS and NMOS) are in the OFF (cut-off) state. This allows the external signal to be read correctly by the processor (via the Input Data Register).
QUICK NOTES ON REGISTER STRUCTURES
2026-05-06 8:04 AM - edited 2026-05-07 5:10 AM
I don't understand the purpose of this post. It's not a question, but doesn't seem to provide much information either. And why does this post have the labels GPIO-EXTI and STM32F3 Series?
@Abdusselam wrote::warning:Note: The internal GPIO structure has been simplified for better conceptual understanding. (Components such as
ESD protection diodes, pull-up and pull-down resistors, etc., are not shown.)
The devil is in the details. I wouldn't leave anything out. Certainly if you want to show what happens on the lowest level.
The basis for all GPIOs of MCUs is very similar. You have a high side switch and a low side switch that can be (somewhat) independently controlled and some input circuit. That's basically it. But it's the details that differ. What are the peculiarities and pitfalls?
Things to consider: