博文

目前显示的是标签为“GPIO pin”的博文

How to use ALT pins on STM32?

图片
 On STM32 , “ALT pins” usually means alternate functions (AF): using a GPIO pin for USART/SPI/I²C/TIM PWM/ADC, etc. You pick the pin’s AF mapping in CubeMX (or write the GPIO registers yourself). Here’s the practical way. The CubeMX way (recommended) Open STM32CubeMX (or CubeIDE → .ioc ). Go to Pinout & Configuration . Enable the peripheral you want (e.g., USART1 , SPI2 , TIM3 PWM ). CubeMX will assign default pins. To use “alt pins”: Click the pin on the package view (e.g., PA9) Choose the function you want (e.g., USART1_TX ) Or open the peripheral settings → GPIO Settings and select alternate pins there. In GPIO Configuration ensure: Mode = Alternate Function Push-Pull (most digital AF signals) Pull-up/down as needed Speed set appropriately (higher for fast edges like SPI) Generate code. CubeMX will create: MX_GPIO_Init() HAL_UART_MspInit() / HAL_SPI_MspInit() etc. that set the AF. Typical HAL GPIO init snippet ...

What is the resistance in Raspberry Pi 5 GPIO pin?

图片
  The resistance of a Raspberry Pi 5 GPIO (General Purpose Input/Output) pin isn't a single fixed value; it depends on whether the pin is acting as an   input   or an   output , and the state it's in. Here’s a breakdown of the different scenarios: 1. As a Digital INPUT Pin When you configure a GPIO pin as an input (e.g., to read a button press), its key characteristic is very high  input impedance . Effective Resistance:  Typically  >1 MΩ  (over 1,000,000 Ohms). Why?  A high-impedance input requires almost no current to read the voltage level. This is ideal for sensing because it doesn't disturb the circuit you are measuring. It's like listening very carefully without talking. Practical Implication:  You must use an external pull-up or pull-down resistor (either physical or internal) to define the pin's state when it's not being actively driven (e.g., when a button is not pressed). The internal pull-up/pull-down resistors are typica...