Pages: 1 [2]   Go Down
Author Topic: Best way for 2 way communication between 3 Dues?  (Read 419 times)
0 Members and 1 Guest are viewing this topic.
Online Online
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm thinking Serial might be my best bet since Due has 4 UART ports. My concern is that only one UART port can be active at one time and I might miss a signal from one of the slaves. Maybe a handshake setup to safeguard data?

Hi Stan,

I'm working on a project with a Master Due, 2 Slave Dues, 2 IMU Sesnors and a Raspberry Pi - all inter connected through serial! The serial ports on the Due all have individual buffers which fill up on an interrupt basis. These buffers can be checked using

NumberOfBytesInBuffer0 = Serial.avaiable()
NumberOfBytesInBuffer1 = Serial1.avaiable()


This way you can check any serial port for data available. You're concern about missing data is fine as long as you are checking these buffers often enough and you're not sending more than 64bytes (Standard buffer size) at one time. I use a start an end character in all my transmissions to ensure I have a correct packet.

I.e. Slave sends: "*StartCharacter*, Command,Data1,Data2,*EndCharacter**NewLine*"

This way I can parse the buffer and ensure I have correct data - (however a checksum would be a more ideal solution but I haven't gotten around to it yet). With this method you can communicate on all serial ports at the same time. The only disadvantage is that the I2C library has Nak/Ack support and is possibly more robust in code (I found I2C hardware to be an issue).

I like serial because to me it's rather simple. Maybe this would be a fall back option if I2C lets you down.

Good Luck,


Hey JW, that does sound look a good solution. Any chance you can post some example code for your 5 way serial communication?

I've been working on getting i2c to work for what I needed it do and I had some minor success but I'm finding the DUE hardware to be fickle. If I can't get i2c to work to the level that I need it, I might switch to serial, especially based on your write up.

Pages: 1 [2]   Go Up
Jump to: