GPIO says General- Purposement EInput /OutputPorts, which means universal I/O ports. Due to the numerous communication peripheral interfaces in MCU, it is impossible to fix a set of GPIO for each peripheral. In MCU microcontroller, the state of pins that can be dynamically configured and controlled during software operation can be used. Therefore, in addition to general input and output functions, each GPIO may also have other reusable functions.

In the MM32L0 product, each GPIO port has two 32-bit configuration registers (GPIOX_CRL, GPIOX_CRH), two 32-bit data registers (GPIOX_IDR and GPIOX_ODR), one 32-position bit/reset register (GPIOX_BSRR), One 16-bit reset register (GPIOX_BRR), one 32-bit lock register (GPIOX_LCKR), and two multiplexing function selection registers (GPIOX_AFRH) and (GPIOX_AFRL).

Each bit of a GPIO port can be configured separately by the software into a variety of modes. – Input float – Input pull up – Input pull down – Analog input – Open leak output – Push-pull output – Push-pull multiplexing – Open leak multiplexing function

Each I/O port can be programmed freely, however I/O port registers must be accessed as 32-bit words (half-word or byte access is not allowed). The GPIOX_BSRR and GPIOX_BRR registers allow independent access to any GPIO registers for read/change; This makes it safe to generate an IRQ between read change accesses.

Figure 1. Basic structure of I/O port bits

1. Input Floating: Floating means that the input pin of a logic device is not connected to either a high or a low level. In general practical use, the pin is not recommended to be suspended, which is easily disturbed.

2, input pull up pull down detail: pull up is to pull the potential higher, such as to VCC. Pull up is to pull an uncertain signal through a resistor at a high level! Weak strength is only the resistance value of the pull-up resistance, there is no strict distinction. In MM32L0XXX, the pull-up resistor position is 40K ohm.

3, analog input details: analog input refers to the analog signal input. When analog input is configured, all pull-up resistors and Schmidt triggers are disabled, so the Input Data Register will not reflect the level state on the port. This means that the CPU will not be able to read valid data in the Input Data Register under the analog input configuration.

4, leakage output details: the output terminal is equivalent to the collector of the transistor, the access to the input data register can get I/O state. Can do different voltage signal conversion; Multiple simultaneous cascades can also implement lines and logic).

5, Push-pull output details: can output high and low levels, connected to digital devices; Push-pull structure generally means that two triodes are controlled by two complementary signals, and always one transistor is on when the other one is off. The high and low levels are determined by the power supply of the IC.

6. Detailed explanation of the reuse function: it can be understood as the configuration situation when the GPIO port is used as the second function (that is, it is not used as the general IO port). Ports must be configured to reuse functional output mode (push – pull or leak).

Lingding Lingding Microelectronics is a leading supplier focusing on MCU products and application solutions in China. It is an integrated circuit design enterprise recognized by the Ministry of Industry and Information Technology of China and Shanghai Information Office, and a high-tech enterprise recognized by Shanghai Municipal Government. Since its establishment in March 2011, Lingxin Microelectronics has successfully completed the design and promotion of hundreds of domestic 32-bit MCU products. Currently, Lingxin Microelectronics has batch supply of MCU products based on ARM Cortex-M0 and Cortex-M3 cores including: MM32F series for the general high-performance market, MM32L series for ultra-low power and security applications, MM32W series with a variety of wireless connectivity functions, MM32Spin series for motor and power supplies, and MM32P series for OTP models, to meet the multi-domain and multi-level application scenarios of customers and markets. General agent Yingshang Microelectronics support to provide free development board testing and routine and other technical support.