FASTPCBA


  • English
Email:pcba13@fastpcba.cn

GPIO- design a microcontroller circuit

date:2018-11-09 15:37:00

GPIO- design a microcontroller circuit


The general purpose input and output (GPIO) pin on the microcontroller can be programmed and can be set to input or output via software.


For example, S1 in Figure 1 is a button that is connected to a GPIO pin that is programmed as an input. The STM32 provides a built-in pull-up resistor, so this button does not require an external pull-up resistor. The GPIO output of this example is used to drive the LED.

Most of the GPIO pins also have other functions, and the various peripheral components on the chip are connected to the outside world through these multi-function pins.

Not all internal functions can be used through each GPIO pin, and strict pin assignments must be followed, so be sure to refer to the data sheet when selecting which pins to use.

20180428134330_6349


The GPIO pin can be used to drive a variety of loads, while most pins can supply or withstand up to 25mA. However, it is generally better to use an external driver circuit to mitigate the microcontroller GPIO drive load. Reference may be made to the example in which the MN1 drives the LED in FIG.

Each pin of the STM32 has a rated current limit and an upper limit for the sum of all GPIO pin currents.

Connecting peripheral components
The STM32 provides serial signal connections via interfaces such as UART, I2C, SPI, and USB.
For example, in Figure 1, a temperature sensor (U2 – LM75BDP) is connected to the microcontroller through the I2C bus. Two pull-up resistors (R2, R3) are required on the I2C bus to connect to the open-drain driver.

For applications such as most low-speed sensors, I prefer to use I2C as a sequence protocol because it uses only two wires for communication. In addition, unlike the SPI that requires additional wafer selection to handle each peripheral component, I2C uses a single address.
The SPI busbar in Figure 1 is connected to the MPU-9250 nine-axis motion sensor from Invensense. The MPU-9250 includes a three-axis accelerometer, a three-axis gyroscope, and a three-axis magnetometer.

Programming connector
The STM32F4 provides two in-system program editing (ISP) interfaces: Serial Line Debug (SWD) and JTAG. The lower version of STM32 only provides the SWD interface. SWD and JTAG are the two programming interfaces most commonly used by microcontrollers.

in conclusion
In this article we discuss the PCB design of the microcontroller and introduce the STM32F4 that reads the input buttons, drives the LEDs, and the I2C temperature sensor and SPI motion sensor communication.
Recommend

News

FASTPCBA 20 years' experience for PCB Assembly.

FASTPCBA Co.,Ltd

  • Building 1, Senyang Electronic Technology Park, Guangming High-tech Park, Yutang Street, Guangming District, Shenzhen City.
  • F:86-13418481618
  • pcba13@fastpcba.cn
Copyright © FASTPCBA Electronics Co.,Ltd All Rights Reserved
Click
then
Contact