IO mode in STM32

Publisher:和谐共处Latest update time:2016-08-05 Source: eefocusKeywords:STM32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Select IO mode in STM32
(1) Floating input_IN_FLOATING - floating input, can be used for KEY identification, RX1
(2) Pull-up input_IPU - IO internal pull-up resistor input
(3) Pull-down input_IPD - IO internal pull-down resistor input
(4) Analog input_AIN - use ADC analog input, or save power under low power consumption
(5) Open drain output_OUT_OD - IO output 0 is connected to GND, IO output 1, floating, an external pull-up resistor is required to achieve high output level. When the output is 1, the state of the IO port is pulled high by the pull-up resistor, but because it is an open drain output mode, the IO port can also be changed to a low level or unchanged by an external circuit. The IO input level change can be read to realize the IO bidirectional function of C51
(6) Push-pull output _OUT_PP - IO output 0- connected to GND, IO output 1 - connected to VCC, the read input value is unknown
(7) Multiplexed function push-pull output _AF_PP - on-chip peripheral function (SCL, SDA of I2C)
(8) Multiplexed function open-drain output _AF_OD - on-chip peripheral function (TX1, MOSI, MISO.SCK.SS)
STM32 setting example:
(1) Simulate I2C using open-drain output _OUT_OD, connected to a pull-up resistor, and can correctly output 0 and 1; when reading the value, first GPIO_SetBits(GPIOB, GPIO_Pin_0); pull high, and then you can read the IO value; use GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_0);
(2) If there is no pull-up resistor, the IO is high by default; if you need to read the value of the IO, you can use the pull-up input_IPU, floating input_IN_FLOATING and open-drain output_OUT_OD
Keywords:STM32 Reference address:IO mode in STM32

Previous article:Three programming download methods for STM32
Next article:arm-linux-gcc make menuconfig error when porting u-boot2015.04

Recommended ReadingLatest update time:2024-11-16 20:38

Serial communication source code based on STM32 Shenzhou series development board
#include "stm32f10x.h" #include "stm32f10x_usart.h"   void RCC_Config(void); void GPIO_Config(void); void USART_Config(void); void Put_String(u8 *p);   int main() {   RCC_Config();//Configure clock   GPIO_Config();//Configure input and output   USART_Config();//Configure sending and receiving /
[Microcontroller]
The error problem of continuous receiving and sending of stm32 serial port
Above code:  Initialization part: /* * Serial port 1 initialization */ void USART1_Initial(void) { USART_InitTypeDef USART_InitStruct; GPIO_InitTypeDef GPIO_InitStructure; // Set IO ports PA10 PA11 multiplexed to the serial port RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);// GPIO_InitStr
[Microcontroller]
The error problem of continuous receiving and sending of stm32 serial port
STM32 delay program, us level delay
According to predecessors, the most taboo thing in embedded system development is program delays and wasted timers, so when writing programs, we try very hard to avoid millisecond-level delays. In addition, general RTOS requires a time base, so we try to use only systick to complete the system time base, milliseconds,
[Microcontroller]
STM32 achieves low power standby summary (current as low as 5.7uA)
After entering STOPMode, the power consumption of the whole machine is 300uA. At this time, the current of other peripheral hardware circuits can be confirmed that the leakage current is at the nA level. Therefore, the debugging direction is on the main chip. After actual testing, it is all a problem of GPIO configurat
[Microcontroller]
STM32 Hardware I2C EEPROM Command Analysis
void I2C_EE_BufferWrite(u8* pBuffer, u8 WriteAddr, u16 NumByteToWrite) {     u8 NumOfPage = 0, NumOfSingle = 0, Addr = 0, count = 0;     //Write the address to see which number of each page     Addr = WriteAddr % I2C_PageSize;     //The number of entries to be written at the beginning of the page     count =
[Microcontroller]
STM32-RCC clock
Preface: I am currently debugging the STM32L152 chip. This article summarizes the RCC clock configuration method of the STM32L152. Hardware platform: STM32L152 Software platform: keil v5+cubeMX Function library: HAL library content:         RCC: Reset and Clock Control, reset and clock control system. There
[Microcontroller]
STM32-RCC clock
STM32 SPI method to read and write SD card
Some time ago, I simulated SPI on 51 to read SD card, and the effect was pretty good. Recently, I ported it to STM32, but there is still a difference between using hardware SPI and software SPI. code show as below: void User_SPIInit(void) {  GPIO_InitTypeDef GPIO_InitStructure;    SPI_InitTypeDef SPI_InitStructure
[Microcontroller]
Analysis of TCP/IP protocol stack code IP & ICMP (STM32 platform)
1. IP Introduction IP is the core protocol in the TCP/IP protocol suite. All packets, such as TCP, UDP, ICMP and IGMP, are encapsulated in the IP datagram format before transmission (see Figure 1-4). Unreliable means that there is no guarantee that an IP datagram will successfully reach its destination. IP only prov
[Microcontroller]
Analysis of TCP/IP protocol stack code IP & ICMP (STM32 platform)
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号