What is the proper method to create the interface to two IIC devices on one bus using Processor Expert?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

What is the proper method to create the interface to two IIC devices on one bus using Processor Expert?

ソリューションへジャンプ
2,939件の閲覧回数
nmay
Contributor III

My current product had a Coldfire processor with an accelerometer on the I2C bus and I used the Processor Expert to configure the interface.  It had a target slave address of 0x1C.  (I had a slight problem with the BUSY detection and did a small modification for that, but other than that the code generated by the Processor Expert worked fine.)

 

Now I have a new design that adds a real time clock to the same I2C bus.  I'm not sure of the correct method to add the new interface.  Do I add a new instance of another InternalII2C component to the current component list with the new device address and indicate the same I2C channel?  Will this figure out that there are two devices on the same channel and perform collision avoidence so they are not both used at the same time and that the registers are set properly to talk to both devices?

 

Or my other option that I feel more in control is to modify the code created for the Accelerometer to allow for both devices to function.  But this seems to defeat the purpose of the processor expert feature.

 

I could not find any white papers or documentation on configuring multiple I2C devices using the Processor Expert even though this seems like a common design practice.

 

Thanks,

--Norm

ラベル(1)
0 件の賞賛
返信
1 解決策
2,764件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hi Norm,

you only need one InternalI2C component. From that component, simply switch between the devices with changing the I2C device address with SelectSlave() method.

One note: if you have different tasks/threads or interrupts accessing the I2C bus, make sure you protect mutual access with a semaphore/mutex.

This is not supported out-of-the-box with the InternalI2C component, so I have created my own wrapper/top level I2C component (GenericI2C, A Generic I2C High Level Driver) which deals with this, plus it works with bit banging I2C (Bit Banging I2C), InternalI2C and I2C_LDD. In case you want use that approach, the components are available on SourceForge (McuOnEclipse Releases on SourceForge).

I hope this helps,

Erich

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
2,765件の閲覧回数
BlackNight
NXP Employee
NXP Employee

Hi Norm,

you only need one InternalI2C component. From that component, simply switch between the devices with changing the I2C device address with SelectSlave() method.

One note: if you have different tasks/threads or interrupts accessing the I2C bus, make sure you protect mutual access with a semaphore/mutex.

This is not supported out-of-the-box with the InternalI2C component, so I have created my own wrapper/top level I2C component (GenericI2C, A Generic I2C High Level Driver) which deals with this, plus it works with bit banging I2C (Bit Banging I2C), InternalI2C and I2C_LDD. In case you want use that approach, the components are available on SourceForge (McuOnEclipse Releases on SourceForge).

I hope this helps,

Erich

0 件の賞賛
返信
2,764件の閲覧回数
nmay
Contributor III

I should mention that this is using CodeWarrior version 10.6

0 件の賞賛
返信
2,764件の閲覧回数
soledad
NXP Employee
NXP Employee

Hello,

Please check the below application notes:

http://cache.freescale.com/files/32bit/doc/app_note/AN3530.pdf

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN3559.pdf


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信
2,764件の閲覧回数
nmay
Contributor III

I checked out the two app notes.  Part of the first note said:

4.6 IIC and SPI drivers

Explaining the IIC and SPI modules is beyond the scope of this document. More information is available at www.freescale.com.

This article focused on USB aspects.  So that was of no help.

And the second app note had a processor interfaced to a single IIC device, which I've done successfully, so that wasn't any value either.

I need to know the proper method to connect multiple I2C devices to a processor using a single bus.  Do I make two instances of the internal I2C component?  Will they not interfere with each other on the bus?...

--Norm

0 件の賞賛
返信