STM8S hardware IIC card is busy, precautions

Publisher:诗意世界Latest update time:2019-11-22 Source: eefocusKeywords:STM8S Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.


Keywords:STM8S Reference address:STM8S hardware IIC card is busy, precautions

Previous article:Introduction to STM8S assembly (1-3)
Next article:STM8 Getting Started Learning and Experiments (Part 2) TIM Timer

Latest Microcontroller Articles
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号