I2C communication protocol doubt

Thread Starter

Electronic_Maniac

Joined Oct 26, 2017
253
Hi All,

I have a doubt in the I2C communication protocol.

This is just for understanding purpose and I dont have a practical application of it.

Suppose, I have a microcontroller (has I2C) and 1 temperature sensor IC which is I2C based.

1 master and 1 slave.

It is said that "Many slave devices will require configuration upon startup to set the behaviour of the device".

What does this mean and how is this configuration achieved? What are we trying to do here by configuring it?

Thanks.
 

Thread Starter

Electronic_Maniac

Joined Oct 26, 2017
253
hi EM,
Do you have a particular I2C temperature device in mind.?
If yes , please post the datasheet or a link, so that we can explain if a set up is required.
E
Hi. As I told before, I dont have any practical application of this question.

My question is just based on the theory which I have read in google which I couldnt grasp.

Maybe, this I2C Temperature IC might help. https://www.mouser.in/datasheet/2/268/25095A-15487.pdf

Thanks. Please help me understand this sentence, "Many slave devices will require configuration upon startup to set the behaviour of the device". What is the purpose of it and how are we achieving it?
 

dendad

Joined Feb 20, 2016
4,637
Some slave devices have hardware address selection inputs so a number of the same units can be used on the same I2C bus.
upload_2018-12-24_21-42-50.png
For example, the above MCP23017 has A0, A1 and A2 so 8 of these can be on the same bus.
That is part of the
"Many slave devices will require configuration upon startup to set the behaviour of the device".
Each device must have a unique address on the same I2C bus.
 

ericgibbs

Joined Jan 29, 2010
21,439
A simple example would be to CONFIG the module for 'continuous' temperature conversions, or SET the Tamb.
Refer image #3.
E

EDIT:
Another example of CONFIG, ref image.
 

Attachments

Last edited:

spinnaker

Joined Oct 29, 2009
7,830
If you want to use multiple temperature sensors then it might be easier to use something like the Dallas DS18B20 on one wire and not IC2.

https://www.sparkfun.com/products/245

Each device has its own unique address. I don't know if there is a limit on the devices on one set of wires. The only issue with one wire is the software required for one wire communication can be very complex. But I have written some code and I would imagine by now there is a library for the Arduino out there.

If you would like the code for the PIC for onewire let me know. You could be able to modify it for pretty much any MCU the way I have written it.

With onewire all you really need is a signal and a ground. With a little more complex software, the signal can actually power the device. Though I have never used that mode.
 
Last edited:

spinnaker

Joined Oct 29, 2009
7,830
A simple example would be to CONFIG the module for 'continuous' temperature conversions, or SET the Tamb.
Refer image #3.
E

EDIT:
Another example of CONFIG, ref image.

I don't have any idea what you are referring to either. Your image refers to continuous output and the TS wants to know how to address multiple devices on IC2.
 

spinnaker

Joined Oct 29, 2009
7,830
Some slave devices have hardware address selection inputs so a number of the same units can be used on the same I2C bus.
View attachment 166345
For example, the above MCP23017 has A0, A1 and A2 so 8 of these can be on the same bus.
That is part of the

Each device must have a unique address on the same I2C bus.
And more can likely be added if you wanted to add your own decoding. And hate to push one wire again but your wiring is going to be a whole lot less complex with one wire..
 

ericgibbs

Joined Jan 29, 2010
21,439
What does this mean and how is this configuration achieved? What are we trying to do here by configuring it?
hi spin,
This quote is from the TS's opening post, ie: configuring was a question he asked.
I asked which I2C device he had in mind.
He posted a single temperature module type, no mention of multiple I2C devices on the same bus.

He then asked.
Thanks but why do we need to do this?
What is the purpose of this action?
So I posted an example.
I don't see a problem with my replies.?

Eric

Thanks. Please help me understand this sentence, "Many slave devices will require configuration upon startup to set the behaviour of the device". What is the purpose of it and how are we achieving it?
 
Last edited:

spinnaker

Joined Oct 29, 2009
7,830
hi spin,
This quote is from the TS's opening post, ie: configuring was a question he asked.
I asked which I2C device he had in mind.
He posted a single temperature module type, no mention of multiple I2C devices on the same bus.

He then asked.


So I posted an example.
I don't see a problem with my replies.?

Eric

Oh it was actually dendad that got me off track. ;)
 

spinnaker

Joined Oct 29, 2009
7,830
Thanks but why do we need to do this?
What is the purpose of this action?
In the particular device that you posted, it has "alarms" for example. They call them alerts. You can set an alert when a particular temperature is reached. It also has a "resolution" feature. Lower resolution means less data your MCU will have to process but of course it is less resolution. A trade off.

It looks like this device also has a device ID. I have not looked at the datasheet in detail but might be a way to address multiple devices on the same IC2 bus.
 

Thread Starter

Electronic_Maniac

Joined Oct 26, 2017
253
I am really sorry. I couldn't still get the concept of configuration.

Please explain in simple terms which can make me understand. All I understood from this post is that, suppose I have a microcontroller and it is connected to 2-3 I2C slaves, based on the data sheets of the MCU and the I2C ICs, I have to set the A0,A1,A2 pins accordingly for the appropriate addressing of the slaves by the MCU. So, the unique address will be given to the slaves connected to the MCU.
Are you implying that the addressing of the slaves is what is called configuration? Or is there something else.

Suppose, if I connect my MCU and the slaves like I have mentioned, will me I2C temperature sensor work appropriately? Or is there anything I have to load to the slave via my MCU?
 

Thread Starter

Electronic_Maniac

Joined Oct 26, 2017
253
hi,
Addressing is not the same as Configuration.
Some I2C devices you buy, will have a unique address, others have generic addresses, some devices have 3 address pins, which can be hardware set.
That's why I asked you the the device type.
E

Read thru this link.
https://electronics.stackexchange.com/questions/261249/clarification-regarding-i2c-address

PDF of address info:
OK. I got the second part. If addressing is not the same as configuration, then can you tell me what is configuration and why it is needed?

Sorry for being so naive/dumb. Please excuse me
 

ericgibbs

Joined Jan 29, 2010
21,439
hi,
This an example I posted earlier.
Say you wanted the device to raise an Alarm flag if the measured temperature exceeded the Alarm set temperature.
You would configure the Alarm SET temperature.
In this clip its the user programmed temp limit, which you had set at start up.
E
AA1 24-Dec-18 16.07.gif
 

Thread Starter

Electronic_Maniac

Joined Oct 26, 2017
253
hi,
This an example I posted earlier.
Say you wanted the device to raise an Alarm flag if the measured temperature exceeded the Alarm set temperature.
You would configure the Alarm SET temperature.
In this clip its the user programmed temp limit, which you had set at start up.
E
View attachment 166350
Thank you. Understood. how is this done? By sending some information to the IC via the MCU?
 
Top