General I2C algorithm

Thread Starter

Pushkar1

Joined Apr 5, 2021
416
I've prepared a I2C flowchart for a single message. I would appreciate it if someone could help me to learn all about the I2C communication protocol

I've attached PDF file of flowchart. @MrChips
 

Attachments

Dave Lowther

Joined Sep 8, 2016
106
@Pushkar1 Do you have some I2C device and a microcontroller you can experiment with or are you just studying the theory? When I was learning to use Arduino with I2C I read the spec at the link in #2 and some tutorials. However, I didn't fully get it until running code and looking at the output on a scope. I use a £99 PicoScope which includes I2C decoding.
 

atferrari

Joined Jan 6, 2004
4,476
After reading about the protocol (somebody posted a link already above) I implemented with two PIC16C57 the big-bang communication master/slave following one of the many tutorials by Nigel Goodwin.

Simpler than I expected.
 

Thread Starter

Pushkar1

Joined Apr 5, 2021
416
I've prepared a I2C flowchart for a study purpose.

Is there any logical mistake for general I2C communication protocol?

Please share your opinion
 

atferrari

Joined Jan 6, 2004
4,476
I've prepared a I2C flowchart for a study purpose.

Is there any logical mistake for general I2C communication protocol?

Please share your opinion
Your "study purposes" do not allow to acknowledge my post. If you go and read what I mentioned most probably would not need to ask others for conformity.

I am done.
 
Last edited:

geekoftheweek

Joined Oct 6, 2013
712
The flow chart is close. When reading from a device it should use the data address from the last write to send data back. In other words the "SEND REGISTER ADDRESS to READ DATA" box won't work. The slave will be expecting to send data to the master instead of reading a new address.
 

Thread Starter

Pushkar1

Joined Apr 5, 2021
416
If you go and read what I mentioned most probably would not need to ask others for conformity.

I am done.
You are saying that we should learn by watching someone else's code that is not bad advice but i avoide this advice because I think copying someone else's code is not right way to learn. I don't think starting with flowchart is a wrong decision for newbie .

This is just my personal opinion. Others may have a different opinion than mine.
 
Last edited:

MrSalts

Joined Apr 2, 2020
740
You are saying that we should learn by watching someone else's code that is not bad advice but i avoide this advice because I think copying someone else's code is not right way to learn. I don't think starting with flowchart is a wrong decision for newbie .

This is just my personal opinion. Others may have a different opinion than mine.
That's not a very efficient or scalable method. Your attitude would quickly change if you had to pay or do community service for one-on-one tutoring of basic and well documented information.
 
Top