The following is the key, the following settings IO can use the hardware IIC normally
GPIO_Init(GPIOB, GPIO_PIN_4, GPIO_MODE_OUT_OD_HIZ_SLOW); //IIC,OD outPut
GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_OUT_OD_HIZ_SLOW); //IIC,OD outPut
//or
GPIO_Init(GPIOB, GPIO_PIN_4, GPIO_MODE_OUT_OD_HIZ_FAST); //IIC,OD outPut
GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_OUT_OD_HIZ_FAST); //IIC,OD outPut
The following settings IO cannot use the hardware IIC normally
GPIO_Init(GPIOB, GPIO_PIN_4, GPIO_MODE_OUT_OD_LOW_SLOW); //IIC,OD outPut
GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_OUT_OD_LOW_SLOW); //IIC,OD outPut
//or
GPIO_Init(GPIOB, GPIO_PIN_4, GPIO_MODE_OUT_OD_LOW_FAST); //IIC,OD outPut
GPIO_Init(GPIOB, GPIO_PIN_5, GPIO_MODE_OUT_OD_LOW_FAST); //IIC,OD outPut
The key is not to set the IIC port to output low level, otherwise it will always be stuck in busy detection. It is not easy to find the problem here because when the IO is initialized first, it is output at a low level, and then when the IIC is initialized, the IIC hardware uses an external pull-up to turn it into a high level. You think the IO port is normal, but it actually fails in the busy detection.
Previous article:Introduction to STM8S assembly (1-3)
Next article:STM8 Getting Started Learning and Experiments (Part 2) TIM Timer
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Wireless RF communication using nRF24L01 module
- Today at 10:00 AM, live broadcast with awards: ADI's technologies and products in China's energy internet applications
- Can ultra-wideband really help all industries resume work and production?
- How to perform on-site PIM testing on RF connectors?
- IAR IDE for MSP430, 8051, ARM and other platforms
- EEWORLD University Hall ---- EMC pre-test environment construction
- [Zhongke Bluexun AB32VG1 RISC-V Evaluation Board] Try to use RTThread multitasking
- CC3200 wireless wifi processor full voice interactive control smart home system
- Pre-registration for the prize live broadcast | ON Semiconductor's advanced image sensor solutions for the Internet of Things
- Free | VIP tickets to EDI CON, the annual RF conference (Beijing, April 1-3)