Pages: [1] 2   Go Down
Author Topic: Two processor arduino  (Read 1627 times)
0 Members and 1 Guest are viewing this topic.
USA
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Don't fix it if it's broken
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 722
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: March 09, 2012, 06:51:43 pm by Constantin » Logged

Washington
Offline Offline
God Member
*****
Karma: 38
Posts: 790
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I suppose SPI is an option also, but with the above, why bother?
Because its simple and robust.
Logged

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!

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 538
Posts: 27069
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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)
Logged

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.

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 217
Posts: 13705
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Constantin
Quote
Easy Transfer library from Bill Porter
Link?
Logged

Rob Tillaart

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

Peoples Republic of Cantabrigia
Offline Offline
God Member
*****
Karma: 6
Posts: 722
Arduino happiness
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: March 10, 2012, 11:13:43 am by Constantin » Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17294
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: March 10, 2012, 09:40:26 am by retrolefty » Logged

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Don't fix it if it's broken
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So my choices are either I2C or SPI basically?
Logged

Washington
Offline Offline
God Member
*****
Karma: 38
Posts: 790
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So my choices are either I2C or SPI basically?
Or serial.
Logged

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!

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Don't fix it if it's broken
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Washington
Offline Offline
God Member
*****
Karma: 38
Posts: 790
Firefox & Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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!

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Don't fix it if it's broken
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 538
Posts: 27069
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Don't fix it if it's broken
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So,should i start looking at other micro controllers?
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 538
Posts: 27069
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

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.

Pages: [1] 2   Go Up
Jump to: