network of microcontrollers (SPI, I2C, CAN...)

I am working on a robot which will contain several microcontrollers, eg some for motor control, some for sensors and one "master". The communication
wires may have to go near motors which is my main concern. I will be using AVRs.
SPI is nice and fast, AVRs support master/slave with hardware addressing, but I am not sure how well it would go with interference. I know that each bit is sampled more than once to detect noise.
I2C is good in that most AVRs have it in hardware and it is easy to connect lots of devices. I don't know how well it can handle noise though.
CAN is good in noisy environments and fast, but it will require a separate chip. I would prefer to keep the size small but if it is so much better then I guess I will use it.
That is what I know, but I don't have any practical experience. Which would you recommend? Does anyone have experience with communication near motors? The furthest distance the wires will go is around 1m.
Thanks for your help! -Daniel
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
[snip]

Use CAN. Microchip do a nice SPI-connected CAN peripheral (the MCP2515), and we have great fun with the robustness properties of CAN...
SPI is okay over short distances (we use it for sensor module to network module communication in fingers, for example) but has *no* robustness properties.
CAN was designed for use in electrically noisy environments.
cheers, Rich.

--
rich walker | Shadow Robot Company | snipped-for-privacy@shadow.org.uk
technical director 251 Liverpool Road |
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
CAN is more than an electrical specificaton. It includes packet collision detection and message priority at the hardware level. Motorola makes some nice micros with CAN on board, just needing an external driver chip. There are also stand-alone controllers as well. http://www.semiconductors.philips.com/pip/SJA1000.html
My micro of choice, the IsoPod, is based on the 56805 micro. It comes CAN capable.
Be wary of the limited capability of some of the devices out there. Compare them to the amount of traffic you anticipate generating. Some micros have more or less buffers than others. This is critical if you anticipate having a master generating requests for data. This will need more recieve buffers .
I have built up little mini can networks with 6 microcontrollers at once. http://www.bio-bot.com/movies /

some
connect
then
would
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Daniel Watman wrote:

If you are really into multi-processor communications, you need lots of physical handshaking and avoid anything that is self timed. I used PICs with no interrupt, and it does IR-RX, 16 speed motor control, handshaking, and multi-processor communications without any problem. My robot also does a little dance routine in background program that is running all at the same time! :-) Interference must be suppressed 100% or its no go with things like IR-RX. Data lines not affected by that much from noise so long as you fit some resistors to load the line to prevent it becoming sensitive to noise if your input is very high impedance. Some stuff I made for other people... http://www.ecu.pwp.blueyonder.co.uk/new/products.htm
J
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Daniel Watman wrote:

I would strongly suggest using RS-485 with a simple serial protocol like ROBIN.
http://enerd.ws/robots/robin /
RS-485 is cheap and easy. -- D. Jay Newman http://enerd.ws/robots /
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
On Tue, Jul 20, 2004 at 04:34:45PM +1000, Daniel Watman wrote:

[...]
I2C is rated for about 1 meter, if I recall, unless you use a bus extender, so I think your bus length is within its capability so that might not be a bad option. It's simple enough to use and works well.
You didn't mention RS485 which has been around for ages, works great, and has excellent noise immunity even over long distances (1000's of feet), think: industrial controls. Just use an inexpensive 8-pin transceiver chip and a UART on your AVR and that's really all you need to create a network.
You also don't have to reinvent the wheel with regard to a simple packet protocol - check out the ROBIN protocol:
http://www.bdmicro.com/code/robin/
That link describes the protocol and also provides a sample implementation for my MAVRIC-II ATmega128 board, which includes the RS485 transceiver on-board. Does I2C and SPI, too :-)
At any rate, I used the ROBIN protocol on my rover here:
http://www.bdmicro.com/rover/
The main controller, one of my MAVRIC-II boards, talks to the two dual h-bridges which control the motors using the ROBIN protocol. Works great. I plan to add more ROBIN nodes as I make enhancements and upgrades to the robot.
-Brian
--
Brian Dean
http://www.bdmicro.com/
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thanks for your replies.
I am leaning towards CAN, but considering RS-485 with ROBIN...
CAN is nice since it has hardware CRC and retransmission, so I can basically just send messages and ignore the details of what is happening. Looking at microchip's MCP2515 transciever and MCP2551 driver.
-Daniel
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Concernig CAN, be wary of buffer depth on your master's rx and tx buffers, and on your slave's rx buffer, if you plan on high throughput.

basically
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.