Arduino: Packet loss on Serial communication -


i trying connect multiple arduino mega boards via serial pins allow communication between boards. want able connect arbitrary amount of arduinos daisy-chaning them , want 1 board master, taking control on actions of other boards. master should determined dynamically boards. aware daisy chaining method introduces delays communication due forwarding of packets, far planning on connection 4 boards @ most. in future might increase maybe 10 boards. boards have separate power source, since connected other hardware has own power source.

my idea connect boards in such way, master determined wireing of boards. thought having "serial" port 'to-master' serial port , "serial1" port "to-child" serial port. boards send hello messages on "to-master" serial port , master replies if received such message on "to-child" serial port. if no answer received after seconds, board determines master.

i wired boards connecting ground pins, , wiring rx1 of master tx0 of child , tx1 of master rx0 of child:

wiring of boards

basically setup working, since boards detect each other , exchange hello messages , replies. there significant amount of packet loss or corruption eliminate.

as simple measure of packet verification, begin each packet "magic number". receiving board looks byte , tries read packet after receiving byte. other bytes received discarded.

as seems, happens quite received on either serial port not start magic number , therefore discarded. timestamps of these events consistent timestamps of sending of other board meaning packet @ least partially transmitted somehow magic byte got corrupted or discarded.

is known problem arduinos serial ports?

can related wiring?

are there measures can take ensure save delivery of packets?

can problem of boards not reading signal @ correct time (i used baud rate of 9600)?

i looked i2c communication, did not find resource or information if possible dynamically choose master type of communication. in documentation stated, important devices share common power source not possible in scenario. however, basic master-slave principle of i2c conforms requirements, have master sends commands other boards. i2c utilized in case?

thank thoughts!

here discussion multi-master i2c topology of arduinos, seems supported (haven't tested myself). - http://forum.arduino.cc/index.php/topic,13579.0.html

you can test spi well, here comparison between 2 - http://components.about.com/od/theory/a/selecting-between-i2c-and-spi.htm. slave might selected generic gpios

i don't know known implementation of multi-clients on top of serial bus (usually intended peer2peer communication only) - though, configuration seems reasonable, considering other options.

btw, comment different power sources, assume boards away each-other. have considered cheap ($2) rf modules, such nrf24l01+ (http://maniacbug.wordpress.com/2011/11/02/getting-started-rf24/). there library networking in multi-node network


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -