Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

OT: I2C question for the expert

OT: I2C question for the expert

2005-05-17 by Gus

Hello,

I need to move data fast between 2 I2C devices ASAP. One device is a 
PIC18F458 micro and the other is an LPC2114 micro. 

1) Is it best if I set up one as a slave and the other as master or 
it is better to set them up both as master/slave?

2) It seems to be too slow to do stop/start conditions when sending 
data. If data is going both dirrections at the same time, is there a 
way to come over start/stop condisions?

3) What address am I allowed to use on I2C? Is there legal issues on 
using sertain I2C addresses? I can only use 7-bit addressing


Thanks,

Gus

Re: [lpc2000] OT: I2C question for the expert

2005-05-17 by microbit

Hi Gus,

> I need to move data fast between 2 I2C devices ASAP. One device is a 
> PIC18F458 micro and the other is an LPC2114 micro. 
> 
> 1) Is it best if I set up one as a slave and the other as master or 
> it is better to set them up both as master/slave?

It depends on who is likely to start the transfer.
 
> 2) It seems to be too slow to do stop/start conditions when sending 
> data. If data is going both dirrections at the same time, is there a 
> way to come over start/stop condisions?

Data can't go in both directions at same time, there's only clock & data.
If 2 devices want the bus, there must be "arbitration".
The data line is pulled low (perhaps on both sides), and then an ACK
is expected.
Due to this arbitration, one device is expected to acquire and one to relinquish the bus.
(Hence why I2C must be wired-OR).

> 3) What address am I allowed to use on I2C? Is there legal issues on 
> using sertain I2C addresses? I can only use 7-bit addressing

Dunno, if you just have these 2 devices, I'd do as I please (proviso you won't connect
I2C peripherals later).
Else the device has an I2C address dictated by what kind it is, and eg. with EEPROM
you'll get 3 ext address pins you can preset.

B rgds
Kris


[Non-text portions of this message have been removed]

Re: OT: I2C question for the expert

2005-05-17 by Gus

Kris,

I read the I2C spec from philips but one thing I am totally unclear 
on! If I have 2 masters and both transmited to eachother at the same 
time. I know one will win the arbitration but since there is only 
one data register in the LPC chip, on the chip that lost 
arbitration, the TX data will not be transmitted and will be over 
written by the the RX data. Is this right? collision? It seems like 
it is a bad idea to have 2 masters transmitting te each other.

Gus

--- In lpc2000@yahoogroups.com, "microbit" <microbit@c...> wrote:
> Hi Gus,
> 
> > I need to move data fast between 2 I2C devices ASAP. One device 
is a 
> > PIC18F458 micro and the other is an LPC2114 micro. 
> > 
> > 1) Is it best if I set up one as a slave and the other as master 
or 
> > it is better to set them up both as master/slave?
> 
> It depends on who is likely to start the transfer.
>  
> > 2) It seems to be too slow to do stop/start conditions when 
sending 
> > data. If data is going both dirrections at the same time, is 
there a 
> > way to come over start/stop condisions?
> 
> Data can't go in both directions at same time, there's only clock 
& data.
> If 2 devices want the bus, there must be "arbitration".
> The data line is pulled low (perhaps on both sides), and then an 
ACK
> is expected.
> Due to this arbitration, one device is expected to acquire and one 
to relinquish the bus.
> (Hence why I2C must be wired-OR).
> 
> > 3) What address am I allowed to use on I2C? Is there legal 
issues on 
> > using sertain I2C addresses? I can only use 7-bit addressing
> 
> Dunno, if you just have these 2 devices, I'd do as I please 
(proviso you won't connect
> I2C peripherals later).
> Else the device has an I2C address dictated by what kind it is, 
and eg. with EEPROM
Show quoted textHide quoted text
> you'll get 3 ext address pins you can preset.
> 
> B rgds
> Kris
> 
> 
> [Non-text portions of this message have been removed]

Re: OT: I2C question for the expert

2005-05-17 by Ken Wada

--- In lpc2000@yahoogroups.com, "Gus" <gus_is_working@y...> wrote:
> Hello,
> 
> I need to move data fast between 2 I2C devices ASAP. One device is a 
> PIC18F458 micro and the other is an LPC2114 micro. 
> 
> 1) Is it best if I set up one as a slave and the other as master or 
> it is better to set them up both as master/slave?
The fastest possible way, and the most straight-fwd, given your line 
of questions...is to ALWAYS rig up ONE master, and everything else as 
SLAVES.

> 
> 2) It seems to be too slow to do stop/start conditions when sending 
> data. If data is going both dirrections at the same time, is there a 
> way to come over start/stop condisions?
Yes, If you have a single MASTER, multiple slave system, then the 
master can always send a repeat start condition, this will maybe save 
a few microseconds...not much, but it is a bit more efficient...

> 
> 3) What address am I allowed to use on I2C? Is there legal issues on 
> using sertain I2C addresses? I can only use 7-bit addressing
There are no legal issues with I2C addresses. You can pretty much use 
any 7-bit address you want. You need to be wary though. If you use ANY 
address, then you will then be unable to use the wide plethora of 
currently available I2C silicon there is out there!

Another brief note about multi-master systems...

Multi-master systems are a pretty cool, yet fraught with pitfalls, 
feature of I2C. In other words, very tricky, but very rewarding once 
you have the system fully debugged.

There are only four modes you need to deal with for multi-master 
systems. They are:

--> Master transmit
--> Master receive
--> Slave transmit
--> Slave receive

Non-intelligent I2C devices ALWAYS communicate slave transmit and 
slave receive modes. In general, when I program up a multi-master 
system, I usually create four (4) separarate buffers. One buffer for 
each mode of operations. In this way, you will, (at the expense of 
memory), will be able to create a pretty efficient multi-master I2C 
device driver....

Do not worry about contention in a multi-master I2C using the LPC2xxx 
device. The LPC2xxx silicon is modeled after the venerable Philips 
80c5xx chip. This I2C silicon has every single I2C vector that is 
defined in the I2C specification! Including generating interrupts on a 
contention violation!

Hope this long-winded explanation helps.

Ken Wada

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.