Maker Pro
Maker Pro

Using I2C inter-board?

C

Chris Carlen

Greetings:

I have two system designs in the works that will need some sort of
communication link between boards. In both cases, there will likely be
a microprocessor board (MB) in the chassis which will facilitate
communications with perhaps a PC, and several other slave boards which
should receive configuration parameters from the MB. I am pretty
certain at this points that the slave boards will only ever have to
receive data, not send. Though acknowledgement might be nice. The
number of slave boards may vary in both applications, so a
communications method that doesn't depend on a hardwired number of
slaves would be required. Data throughput will be low, just a few dozen
bytes or so every once in a while.

This all sounds like the realm of I2C.

The first case is a research lab fuel injector driver system which
should support 1-4 injector power driver modules. Each module should
accept configuration data from the MB consisting of the inject durations
and pause lengths for multiple injection sequences initiated by a single
trigger pulse (which goes directly to the power module, not through the
data comm link). The MB in this case will have the typical keypad and
character LCD user interface. It will also provide a PC interface for
remote setting of these parameters.

The second case is an abstract laser light-show projection system which
will employ 4-6 DDS function generators based on AVR microcontrollers.
Each DDS has its own user interface and display capability for setting
frequency and phase of its dual outputs, but I'd like to also be able to
command them remotely for computer sequencing of the displayed patterns.
Thus to implement a remote interface, I plan to have a MB that will
string I2C to all the DDS modules.

It would seem that in terms of hardware configuration of the
communication system, in the case of multiple identical "slave" units,
that they would need something like DIP switches to set unique
addresses. But from what I have read about I2C (just a brief intro this
evening) there is a hardware call command which can allow the master to
figure out how many folks it's talking to. So this would mean I don't
have to provide any user configuration facilities within the MBs to tell
them how many slaves they are talking to.

I have also taken some initial looks at CAN bus, which seems a bit more
involved and also capable than I2C, as well as being suitable for longer
distance communication. But it seems that I2C might be a more
approachable first step for me into the realm of communication hardware
layers, which also looks likely to serve my needs for the immediate
projects.

That leads to my main question:

Does it seem like I am on the right track in considering I2C for these
applications? To be sure, the I2C busses in each case would be
contained within only a single chassis, but I am planning to route the
bus between several boards (either via a backplane or just a daisy
chained cable), rather than just between several chips on a single board.

Any other approaches I should consider?


Thanks for input.
 
P

petrus bitbyter

Chris Carlen said:
Greetings:

I have two system designs in the works that will need some sort of
communication link between boards. In both cases, there will likely be
a microprocessor board (MB) in the chassis which will facilitate
communications with perhaps a PC, and several other slave boards which
should receive configuration parameters from the MB. I am pretty
certain at this points that the slave boards will only ever have to
receive data, not send. Though acknowledgement might be nice. The
number of slave boards may vary in both applications, so a
communications method that doesn't depend on a hardwired number of
slaves would be required. Data throughput will be low, just a few dozen
bytes or so every once in a while.

This all sounds like the realm of I2C.

The first case is a research lab fuel injector driver system which
should support 1-4 injector power driver modules. Each module should
accept configuration data from the MB consisting of the inject durations
and pause lengths for multiple injection sequences initiated by a single
trigger pulse (which goes directly to the power module, not through the
data comm link). The MB in this case will have the typical keypad and
character LCD user interface. It will also provide a PC interface for
remote setting of these parameters.

The second case is an abstract laser light-show projection system which
will employ 4-6 DDS function generators based on AVR microcontrollers.
Each DDS has its own user interface and display capability for setting
frequency and phase of its dual outputs, but I'd like to also be able to
command them remotely for computer sequencing of the displayed patterns.
Thus to implement a remote interface, I plan to have a MB that will
string I2C to all the DDS modules.

It would seem that in terms of hardware configuration of the
communication system, in the case of multiple identical "slave" units,
that they would need something like DIP switches to set unique
addresses. But from what I have read about I2C (just a brief intro this
evening) there is a hardware call command which can allow the master to
figure out how many folks it's talking to. So this would mean I don't
have to provide any user configuration facilities within the MBs to tell
them how many slaves they are talking to.

I have also taken some initial looks at CAN bus, which seems a bit more
involved and also capable than I2C, as well as being suitable for longer
distance communication. But it seems that I2C might be a more
approachable first step for me into the realm of communication hardware
layers, which also looks likely to serve my needs for the immediate
projects.

That leads to my main question:

Does it seem like I am on the right track in considering I2C for these
applications? To be sure, the I2C busses in each case would be
contained within only a single chassis, but I am planning to route the
bus between several boards (either via a backplane or just a daisy
chained cable), rather than just between several chips on a single board.

Any other approaches I should consider?


Thanks for input.




--
_____________________
Christopher R. Carlen
[email protected]
Suse 8.1 Linux 2.4.19


Christopher,

The IIC bus
http://www.semiconductors.philips.com/buses/i2c/index.html
has been developped with your needs in mind.
However, it's up to yourself to make a reliable design so you need a good
understanding of the protocol. One misbehaving slave for instance can hold
the bus forever so effectively make it hang. As far as addressing is
concerned, every connected item requires a unique address. So you cannot
have two slaves using the same address on a bus. It's also up to the
designer to decide which addresses are recognised by the master. Just a
matter of implementatoin.

petrus
 
J

Joerg

Hi Chris,

I don't know these uCs. But in the past I used whatever the uC had on board
or where they offered ready-to-go low level firmware modules. I2C, SPI,
RS232, it didn't make a difference.

Regards, Joerg
 
F

Frank Bemelman

Chris Carlen said:
The second case is an abstract laser light-show projection system which
will employ 4-6 DDS function generators based on AVR microcontrollers.
Each DDS has its own user interface and display capability for setting
frequency and phase of its dual outputs, but I'd like to also be able to
command them remotely for computer sequencing of the displayed patterns.
Thus to implement a remote interface, I plan to have a MB that will
string I2C to all the DDS modules.
[snip]

That leads to my main question:

Does it seem like I am on the right track in considering I2C for these
applications? To be sure, the I2C busses in each case would be
contained within only a single chassis, but I am planning to route the
bus between several boards (either via a backplane or just a daisy
chained cable), rather than just between several chips on a single board.

Any other approaches I should consider?

I suggest you also take a look at RS485. This is half duplex and
also usable for very long distances. Figuring out how many slaves
the system has, can be done in software, each slave should have a
unique address. Since you plan to use it also for a laser show,
have a look at DMX512 protocol. DMX512 is used for professional
lighting equipment, and uses the same type of bus. There are also
a lot of industrial I/O modules with RS485, often with simple
communication protocols. Might be handy if you suddenly need to
add a few IO connections, for an extra relay or something.

IIRR, DMX512 uses a fixed but non standard baudrate. You should
check if your hardware can generate that baudrate, if you want
to support DMX512.
 
C

Chris Carlen

Frank said:
The second case is an abstract laser light-show projection system which
will employ 4-6 DDS function generators based on AVR microcontrollers.
Each DDS has its own user interface and display capability for setting
frequency and phase of its dual outputs, but I'd like to also be able to
command them remotely for computer sequencing of the displayed patterns.
Thus to implement a remote interface, I plan to have a MB that will
string I2C to all the DDS modules.

[snip]


That leads to my main question:

Does it seem like I am on the right track in considering I2C for these
applications? To be sure, the I2C busses in each case would be
contained within only a single chassis, but I am planning to route the
bus between several boards (either via a backplane or just a daisy
chained cable), rather than just between several chips on a single board.

Any other approaches I should consider?


I suggest you also take a look at RS485. This is half duplex and
also usable for very long distances. Figuring out how many slaves
the system has, can be done in software, each slave should have a
unique address. Since you plan to use it also for a laser show,
have a look at DMX512 protocol. DMX512 is used for professional
lighting equipment, and uses the same type of bus. There are also
a lot of industrial I/O modules with RS485, often with simple
communication protocols. Might be handy if you suddenly need to
add a few IO connections, for an extra relay or something.

IIRR, DMX512 uses a fixed but non standard baudrate. You should
check if your hardware can generate that baudrate, if you want
to support DMX512.

Thanks for the input.

Since I am talking about relatively short distances of about <1m
compared to RS485's 1200m, is there any reason *not* to use I2C?

Also, it seems likely that I2C could be done with a minimum of
additional components, since I can take it direct from the uC, whereas
for the RS485, I'd need differential driver/receiver chips. Or maybe
not, since I'm not going over a long haul, so I needn't really conform
to the hardware layer standards, huh?

I don't know anything about how arbitration is handled with RS485, but
perhaps it isn't an issue since a slave would only talk after being
addressed. But it might be easier with I2C to not have to hardcode or
configure the slave addresses in the master, and use the "hardware call"
to learn about the slaves. Because with I2C I think the arbitration is
handled in the uC peripherals. The software would just have to collect
all the returning communications after the call is issued, no matter
what the order they come in.

Any corrections to the way I am conceiving of things are welcome.


Good day!



--
____________________________________
Christopher R. Carlen
Principal Laser/Optical Technologist
Sandia National Laboratories CA USA
[email protected]
 
J

Joerg

Chris, if your uC can natively do I2C already then I suggest to go for it. I
can't see any reason why not. This protocol is well proven and I never had a
problem with it, even when running it over pretty sloppy cables in the lab.
It's been long ago but things could only be better today. The reason why I
haven't used it lately is because I used uCs such as the C51 series which came
with RS232 (but I believe you can get those with I2C as well).

Regards, Joerg
 
F

Frank Bemelman

Chris Carlen said:
Thanks for the input.

Since I am talking about relatively short distances of about <1m
compared to RS485's 1200m, is there any reason *not* to use I2C?

The few times I used I2C was for dedicated chips, such as eeprom
and RTC clock. I have never used it between two processors. There
is no particular reason to avoid it, or it must be that it works
a bit strange, and tougher to debug when it doesn't work. I did
a I2C once by bit banging standard IO pins, and had to read the protocol
datasheets quite a number of times....
Also, it seems likely that I2C could be done with a minimum of
additional components, since I can take it direct from the uC, whereas
for the RS485, I'd need differential driver/receiver chips. Or maybe
not, since I'm not going over a long haul, so I needn't really conform
to the hardware layer standards, huh?

Well, adding a RS485 driver is mandatory, it's a bidirectional
party bus, and connects to the UART pins of a uC, and you have
to connect multiple slaves.
I don't know anything about how arbitration is handled with RS485, but
perhaps it isn't an issue since a slave would only talk after being
addressed. But it might be easier with I2C to not have to hardcode or
configure the slave addresses in the master, and use the "hardware call"
to learn about the slaves. Because with I2C I think the arbitration is
handled in the uC peripherals. The software would just have to collect
all the returning communications after the call is issued, no matter
what the order they come in.

The simplest form has one master, that polls the slaves. You can write
your own simple protocol, send a string of characters where the first
two are the address and the rest is data and checksum. Slaves listen all the
time, and respond when they are called, assuming the master listens after
sending a command. You can keep it simple or make it as complicated as
you want.

If your slaves are also controllers (not simple I2C chips such as IO)
then I would choose RS485. At least that can be analysed without
special equipment, just hookup a terminal with a RS232/RS485 converter
and you can see what going on. Choosing a protocol that uses printable
characters makes this very comfortable.
 
C

Chris Carlen

Frank said:
Well, adding a RS485 driver is mandatory, it's a bidirectional
party bus, and connects to the UART pins of a uC, and you have
to connect multiple slaves.




The simplest form has one master, that polls the slaves. You can write
your own simple protocol, send a string of characters where the first
two are the address and the rest is data and checksum. Slaves listen all the
time, and respond when they are called, assuming the master listens after
sending a command. You can keep it simple or make it as complicated as
you want.

If your slaves are also controllers (not simple I2C chips such as IO)
then I would choose RS485. At least that can be analysed without
special equipment, just hookup a terminal with a RS232/RS485 converter
and you can see what going on. Choosing a protocol that uses printable
characters makes this very comfortable.


Frank, got any recommendations on single chips that contain both
receivers *and* drivers for RS485? I am only familiar with the MAX232
type stuff.


Thanks.


--
____________________________________
Christopher R. Carlen
Principal Laser/Optical Technologist
Sandia National Laboratories CA USA
[email protected]
 
F

Frank Bemelman

Frank, got any recommendations on single chips that contain both
receivers *and* drivers for RS485? I am only familiar with the MAX232
type stuff.

There are dozens of candidates, all in an 8 pin package, all
with the same compatible pin layout. LTC485, AD485, etc. There
are also pretty expensive ones, functionality is the same, but
these offer extra protection against abuse.
 
Top