STM32 GPIO Lecture 8 : GPIO Programming Structure

 

GPIO Programming Structure

 

 

 

GPIO Programming Structure
Figure 1. GPIO registers

 

GPIO port is governed by many registers, as shown in Figure 1. These registers may vary depending on the vendors who design microcontroller.

The minimum set of registers that you find in any microcontroller is direction register, which is also called mode register. By using this register, you can set direction or mode as input, output, analog, etc..

Input data register which is used to read from a GPIO port and

Output data register which is used to write to a GPIO port.

In the STM32F4xx series of microcontrollers, each GPIO port governed by many configuration registers. They are:

  1. GPIO Port Mode register (GPIOx_MODER).
  2. GPIO Output Type register (GPIOx_OTYPER)
  3. GPIO Output Speed register (GPIOx_OSPEEDR) 
  4. GPIO Pull Up /Pull Down  register (GPIOx_PUPDR)
  5. GPIO Input Data register (GPIOx_IDR)
  6. GPIO Output Data register (GPIOx_ODR)
  7. GPIO Bit Set / Reset register (GPIOx_BSRR)
  8. GPIO Lock register (GPIOx_LCKR)
  9. GPIO Alternate Function register (GPIOx_AFRHand GPIOx_AFRL)

 

All these GPIO registers are connected over a system bus to the processor as shown in Figure 2.

 

Block diagram of STM32F7xx discovery
Figure 2. Block diagram of STM32F7xx discovery

 

In Figure 2. Shows that all GPIO ports connected to the processor over the AHB1 bus. AHB1 is a primary system bus that can operate at a maximum of 168 MHz clock speed.

In the following article, let’s explore GPIO PORT and PINs of STM32F4xx discovery board.

 

FastBit Embedded Brain Academy Courses,

Click here: https://fastbitlab.com/course1

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.