Two processor arduino

would like to make a custom Arduino board using towo Atmega2560s. I was wondering how they could communicate with each other?

Couple of obvious options...

Consider using the Easy Transfer library from Bill Porter... it makes transfers much easier.

4 serial ports beckon, each can reliably go up to 1Mbit/s with a 16MHz processor speed, even if the Arduino IDE does not support those speeds in its serial terminal window.

If you use Easy Transfer, you could even use I2C to move data.

I suppose SPI is an option also, but with the above, why bother?

Constantin:
I suppose SPI is an option also, but with the above, why bother?

Because its simple and robust.

What do you have planned that needs so much IO, or serial, or SPI, or ...

The '2560's are not cheap either.

Maybe use 2 of these to prove out the connectivity & 'stuff'
http://www.schmartboard.com/index.asp?page=products_qfp&id=70
(confirm the pitch of the pins before ordering, there are other spacings as well)

@Constantin

Easy Transfer library from Bill Porter

Link?

Here is a link to Bill Porters Easy Transfer page.

I found using his library simplified communications incredibly for me between Arduinos. The library is lightweight, easy to implement, very easy to use. You simply define the variables you want to send on both ends, and the library does the rest, including CRC checksums.

While I am certain that one could do the same using SPI, I found the above to be very robust, fast enough for my needs, and much easier to implement. Perhaps smeezekitty can extend Easy Transfer to use SPI the same way that Kumy extended Easy Transfer to I2C?

One aspect of I2C I really like is that one does not have to sacrifice more than two pins from the MCU, regardless of how many devices are on the bus. Yes, one has to pay attention to the pull-up resistors, especially in fast mode, but it's nothing too difficult to implement. With SPI, one always has to pay attention to the state of the SS pin(s) and the minimum MCU pin count is 4 for bi-directional usage.

No doubt, you can move a lot more data via SPI and it's a bit more robust than I2C in terms of the maximum length it's good for. However, for robust communications, I still rely on RS485 and serial RX and TX. Maybe not the fastest implementation, but relatively easy to debug on both ends. I guess it comes down to how much data has to be moved.

Constantin:
Here is a link to Bill Porters Easy Transfer page.

I found using his library simplified communications incredibly for me between Arduinos. The library is lightweight, easy to implement, very easy to use. You simply define the variables you want to send on both ends, and the library does the rest, including CRC checksums.

While I am certain that one could do the same using SPI buses, I found the above to be very robust, fast enough for my needs, and much easier to implement. Since using SPI is so easy for him/her, perhaps smeezekitty can write a SPI implementation of Easy Transfer the same way that Kumy extended Easy Transfer from just Serial communications to I2C.

I agree. The real 'power' of the Easy Transfer library is that it transfers a single user's structure type that can include many individual variables and arrays, as it just transfers the contents of the total structure from the sending arduino to the receiving arduino, saving the receiving sketch from having to parse the serial bytes one at a time and storing them into individual variables and arrays. It's a very simple yet elegant solution for sending a lot of variables between connected arduino boards, that takes real advantage of using the power of the C struct type. Recommended.

Lefty

So my choices are either I2C or SPI basically?

tmbates12:
So my choices are either I2C or SPI basically?

Or serial.

The main obstacle is the limitations of the arduino software's serial speed.

How fast do you need.
All of these methods can go fairly fast but they all have limitations.

I would like it fast enough to have both atmegas to be able to run large i/o intensive programs at the same time.

So, you can have fast IO and spend all your time doing data comm's, or you spend all your time doing I/O intensive stuff - can't do both at once, only have so many instructions/second at your disposal.

So,should i start looking at other micro controllers?

Really depends how much data/stuff you want to send back & forth. Short burts of data at high speed would be okay, recipient could pull it in & do whatever then go back to doing the i/o intensive stuff. Long bursts would take more time away from the i/o intensive stuff.

tmbates12:
So,should i start looking at other micro controllers?

No, first you should put measurable numbers on what 'extensive' means. How much data has to move in volume in how much time, what are the latency time values you have to meet on servicing the tasks that have to respond to for input pin changes, etc.

Otherwise our suggestions are just guesses at what you may or may not require, as well as recommending some other controller type.

Lefty

You can use dual ported RAM, they are pretty cheap these days and give you 1 or 2k of common memory. Look at the IDT71V30, CY7C131 etc. Can't get much faster than that.

Can you explain more what needs to be done, it's probable that a faster processor is the way to go really. Remember that the mythical ARM Arduino will be coming out before long (yeah right :)), I'm currently working on an ARM Arduino and can advise on using the SAM3U if needed.

The SAM has about 96 IO lines depending on what combination of IO you need.


Rob

I guess I'd like to have a better idea of what the needs are in the first place.

How much data has to be pushed? That in turn will determine how many cycles each Arduino will spend transmitting and receiving the stuff. 1Mbit/s over serial is easy to implement natively. That's a lot of data. Allegedly. I2C gets up to 100kB/s in fast mode. Sooner than later, you'd run out of RAM at these speeds... so a 'bigger' processor may be needed not because of the bus speeds but because the Arduinos are presently not blessed with a lot of RAM.

Very powerful alternatives that are attempting to marry a 32-bit microprocessor with shield compatibility and fairly successful IDE compatibility include the Maple system from LeafLabs or the Digilent Chipkit versions out there. Neither is a drop-in replacement, Arduino code may not work as well as intended but these are powerful chips...

tmbates12:
So,should i start looking at other micro controllers?

You would have the same questions there anyway. You need to quantify things. How much data? How much needs to be exchanged? How often? SPI is fastest and is done in hardware so, within reason, you can be doing other things.

Well, i've decided to use the xmega128A1 ill keep u guys posted.