2 The Smart “Things” in IoT
73
• Stack Pointer (SP) – Register R13 stores the address of the last item in a stack.
• Link Register (LR) – Register R14 is responsible for holding and returning
information needed for function calls, exceptions, and subroutines.
• Program Counter (PC) – Register R15 stores the most recent program address.
• One Program Status Register (PSR) – This register combines the following
components:
– Application Program Status Register (APSR) – Stores condition code flags
– Interrupt Program Status Register (IPSR) – Includes the Interrupt Service
Routine (ISR) number of current exception activation
– Execution Program Status Register (EPSR)
2.5.3 GPIOs and Interfaces
2.5.3.1 General-Purpose Input/Output (GPIO)
GPIO stands for general-purpose input/output. GPIOs are standard interface available on every modern microcontroller. These interfaces are used to connect external
device, sensors, and actuators to microcontrollers. When functioning as an input
port, the GPIO can communicate with the CPU regarding sensor readouts or
“on/off” signals received from switches. When functioning as an output port,
GPIO can trigger external operations in accordance with CPU instructions and
calculations. For example, a GPIO can be used to send control signals of a DC
motor or to control (turn on/off) an LED.
GPIOs are general-purpose elements because individual pins can function
independently as an input or output based on their application-level configuration.
Traditional MCUs included ports that were used solely for input or output. More
modern GPIOs are more adaptable. For example, if a GPIO contains eight pins,
each can be set to meet customized needs: 7 input/1 output, or 4 input/4 output, etc.
In general, GPIOs are clustered into several ports to be able to manage them
simply. In simple words, a port is a group of IO pins that are addressed/configured
as one logical entity/channel and all pins in one port work in a similar way. For
instance, STM32F411RET6 is an ARM microcontroller with 64 pins. Fifty-two
of those pins are available for GPIO. In this specific microcontroller, GPIOs are
clustered into five ports in a way that arranges ports A, B, and C to be 16-bits wide,
port D to be 1-bit wide, and port H to be 3-bits wide.
It is also important to note that an ARM Cortex-M includes three digital input
modes for GPIO:
• Input with Internal Pull-Up
• Input with Internal Pull-Down
• Input Floating
73
• Stack Pointer (SP) – Register R13 stores the address of the last item in a stack.
• Link Register (LR) – Register R14 is responsible for holding and returning
information needed for function calls, exceptions, and subroutines.
• Program Counter (PC) – Register R15 stores the most recent program address.
• One Program Status Register (PSR) – This register combines the following
components:
– Application Program Status Register (APSR) – Stores condition code flags
– Interrupt Program Status Register (IPSR) – Includes the Interrupt Service
Routine (ISR) number of current exception activation
– Execution Program Status Register (EPSR)
2.5.3 GPIOs and Interfaces
2.5.3.1 General-Purpose Input/Output (GPIO)
GPIO stands for general-purpose input/output. GPIOs are standard interface available on every modern microcontroller. These interfaces are used to connect external
device, sensors, and actuators to microcontrollers. When functioning as an input
port, the GPIO can communicate with the CPU regarding sensor readouts or
“on/off” signals received from switches. When functioning as an output port,
GPIO can trigger external operations in accordance with CPU instructions and
calculations. For example, a GPIO can be used to send control signals of a DC
motor or to control (turn on/off) an LED.
GPIOs are general-purpose elements because individual pins can function
independently as an input or output based on their application-level configuration.
Traditional MCUs included ports that were used solely for input or output. More
modern GPIOs are more adaptable. For example, if a GPIO contains eight pins,
each can be set to meet customized needs: 7 input/1 output, or 4 input/4 output, etc.
In general, GPIOs are clustered into several ports to be able to manage them
simply. In simple words, a port is a group of IO pins that are addressed/configured
as one logical entity/channel and all pins in one port work in a similar way. For
instance, STM32F411RET6 is an ARM microcontroller with 64 pins. Fifty-two
of those pins are available for GPIO. In this specific microcontroller, GPIOs are
clustered into five ports in a way that arranges ports A, B, and C to be 16-bits wide,
port D to be 1-bit wide, and port H to be 3-bits wide.
It is also important to note that an ARM Cortex-M includes three digital input
modes for GPIO:
• Input with Internal Pull-Up
• Input with Internal Pull-Down
• Input Floating
