STM32 GPIO Lecture 10 : GPIO MODE REGISTER

 

GPIO MODE REGISTER

 

 

 

Let’s understand the GPIO mode register in this article. The very first register is the port mode register, and the name of this register is GPIOx_MODER. Here x can be replaced any GPIO port name from A to I as shown in Figure 1 and for each peripheral, there will be one moder register.

 

GPIO mode register
Figure 1. GPIO Port Mode Registers

 

The size of the GPIO port mode register is 32 bits, and the configuration length of each port mode register is 2 bits as shown in Figure 2.

 

 32-bit GPIO port mode register
Figure 2. 32-bit GPIO port mode register

 

These configuration bits are written by software to configure the I/O direction mode:

00: Input (reset state)

01: General purpose output mode

10: Alternate function mode

11: Analog mode

Very commonly used modes are input mode, general-purpose output mode, and alternate function mode. ADC or DAC uses Analog mode. Also, whenever a microcontroller undergoes reset all the pins of different GPIO port will be by default in the input state.

In the following article, let’s see Input configuration of Microcontroller’s GPIO Pin

 

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.