STM32 Microcontroller- GPIO structure


GPIO Pin and GPIO Port

             GPIO pin stands for General Purpose Input Output. GPIO's typically used for reading digital signals, generating triggers for external components, issuing interrupts, waking up the processor and many. A GPIO port is a collection of some fixed numbers of I/O pins, STM32 based microcontroller support GPIO port of 16 pins PA.0 to PA.16. 

Each GPIO Port is governed by many registers, These registers may vary depending upon the vendor who designs the microcontroller. Generally, in the microcontroller a GPIO port is govern by these registers.

*Port Direction (Mode) Register- By using these registers, we can set the direction or mode as an input, output, analog etc.

*Port Input Data Register- It is used to read from a GPIO port.

*Port Output Data Register- It is used to write to a GPIO port.

 Enabling and Disabling GPIO Ports

To enable or disable any particular peripheral, we need to enable/disable its internal clock, which is termed as Peripheral Clock. In STM32, RCC (Reset and Clock Controller) is the engine which controls the clock for all the domain of the microcontroller. 


So, according to the block diagram we know that various GPIO ports are actually connected or hanging to the APB1 bus.  That's why in the RCC register set so we have to go and consult the RCC_AHB1ENR and there we will find the enabling and disabling bits to control the clock of various GPIO ports.


                        If we refer image above, if we make GPIOAEN bit as 1, the clock for GPIOA port will be enabled. So, if we make this corresponding bit as 0 the clock for GPIOA port will be disabled. That's about enabling and disabling peripheral clock for GPIO port.

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1208825570894522"
     crossorigin="anonymous"></script>

Comments

Popular posts from this blog

The Hidden You

What's Important in Life