Overview of GPIO pins

Stable: 25.11.2021 - 09:26 / Revision: 12.10.2021 - 16:14

I am here to prevent the first-page-empty bug!

Template:ArticleMainWriter Template:ArticleApprovedVersion


SUMMARY
Each STM32 ball/pin is multiplexed in order to support multiple functions. For example, an STM32 pin can operate in three different modes: GPIO, alternate functions or analog. All pin settings are performed via the GPIO internal peripheral, which can be configured through Linux® kernel. This is the purpose of this article.

1 Purpose

This article introduces the Linux® kernel frameworks dedicated to pin configuration and control. Its purpose is to provide to newcomers some first insights regarding pin management frameworks. Detailed information are provided in the articles referenced in this page.

2 System overview

Pin overview.png

ST microprocessor pin can be configured in several modes:

  • General-purpose input/output (GPIO): controlled by software
  • Alternate functions: controlled directly by a hardware block.
  • Analog: controlled directly by a hardware block.

Refer to GPIO internal peripheral for more hardware details.

Two frameworks can be used to configure and control a given pin: pinctrl and GPIOLib. They are selected according to pin usage:

  • pinctrl is used mainly when a pin is controlled by an internal peripheral. Pinctrl handles the pin configuration and allows assigning a specific feature to a pin. The Pinctrl overview article provides an overview of the pinctrl framework.
  • GPIOLib is used when a pin needs to be controlled dynamically at runtime (GPIO). GPIOLib is used to control a pin by software. The GPIOLib overview article provides an overview of the GPIOLib framework.

In addition, when a pin is used as external interrupt source, Irqchip framework[1] offers an API allowing the configuration of this interrupt.


3 Trainings

Bootlin proposes a detailed presentation of those frameworks: character device interface, Linux Kernel and Driver Development training document, see Introduction to pin muxing chapter.

4 References

  1. Interrupt Management training document, Linux Kernel and Driver Development
IMPORTANT NOTICE – READ CAREFULLY
STMicroelectronics NV and its subsidiaries ("ST") reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST’s terms and conditions of sale in place at the time of order acknowledgment.

Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of purchasers’ products.

No license, express or implied, to any intellectual property right is granted by ST herein.

Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product.

ST and the ST logo are trademarks of ST. For additional information about ST trademarks, refer to www.st.com/trademarks. All other product or service names are the property of their respective owners.

Information in this document supersedes and replaces information previously supplied in any prior versions of this document.