Go Down

Topic: Two processor arduino (Read 1 time) previous topic - next topic

tmbates12

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

Constantin

#1
Mar 10, 2012, 12:47 am Last Edit: Mar 10, 2012, 12:51 am by Constantin Reason: 1
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?

smeezekitty


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

Because its simple and robust.
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

CrossRoads

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

The '2560's are not cheap either.
http://www.mouser.com/ProductDetail/Atmel/ATmega2560-16AU/?qs=sGAEpiMZZMtkfMPOFRTOl4TPj%252bk4h3O1

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)
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

robtillaart

@Constantin
Quote
Easy Transfer library from Bill Porter

Link?
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Constantin

#5
Mar 10, 2012, 03:09 pm Last Edit: Mar 10, 2012, 05:13 pm by Constantin Reason: 1
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.

retrolefty

#6
Mar 10, 2012, 03:38 pm Last Edit: Mar 10, 2012, 03:40 pm by retrolefty Reason: 1

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

tmbates12

So my choices are either I2C or SPI basically?

smeezekitty


So my choices are either I2C or SPI basically?

Or serial.
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

tmbates12

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

smeezekitty

How fast do you need.
All of these methods can go fairly fast but they all have limitations.
Avoid throwing electronics out as you or someone else might need them for parts or use.
Solid state rectifiers are the only REAL rectifiers.
Resistors for LEDS!

tmbates12

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

CrossRoads

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.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

tmbates12

So,should i start looking at other micro controllers?

CrossRoads

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.
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Go Up