I2C debugging Summary

Source: Internet
Author: User

Debug I2C modules in the near future. I think I am the most familiar with I2C. One is that the Protocol price is simple, and the other is that this module is also available in the set-top box. However, this familiar thing has made me tune it for three days! Some of the failure lessons are summarized as follows to learn from yourself and later.

 

1. When there is no problem with all the time sequences, I modified the address of the I2C controller during initialization. Later, I thought that this step has little impact on the entire program. However, after this step was changed, the 8-segment digital tube was actually lit up! (I used to debug zlg's 8-segment digital tube and keyboard module)

 

2. This step may be very important. Is the speed of I2C. I have checked many posts on the Internet, and many of my predecessors have said that most problems with I2C are caused by speed.

If you are here to debug I2C, please take a look at your speed! The following speed is available in many places:

I2C bus transmission rate:
The maximum speed in standard mode is kb/s.
Up to kb/s in quick mode.
Up to 3.4 Mbit/s in high-speed mode. This speed first slows down a bit, and then debug it slowly. It seems that only when debugging reaches the best state, all I2C data will be transmitted correctly without leaking! That's amazing! 3. Note that the I2C bus can only be initialized once when one master node and multiple slave nodes exist! Do not initialize the device when it communicates with the second device! Otherwise, it will definitely fail! 4 some people on the Internet say that when reading the register value, there is a high latency before writing the device address and sending the start address again. In this step, I did it at first and later found that it was not of much use. However, a delay is required after the test is completed. Otherwise, the first data cannot be received! It is possible that the I2C bus sometimes requires some latency, and I cannot understand it. 5. This step is related to timing issues. I2C write: start -- slave address (w) -- slave acknowledge -- Data-stop
I2C read: start -- slave address (r) -- slave acknowledge -- Data-Non acknowledge -- stop do you see? Non acknowledge -- stop is indispensable! I found that when the two are missing, there will be a 20% error! So you can stop it without answering the question! I forgot to stop this step! It's strange to myself! That is, the current program is written in this format:-Non acknowledge -- stop-data is to stop the signal and then receive data. This is the only way to do it! Khan! That's all! What will happen next time!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.