by doc-helmut » 12 Sep 2012, 14:59
thx for the advice, but checksum or better alternatives for error detection are not the point in the moment and I don't understand anything about bitbus and so on...
The main problems are data corruption, dropping messages, message crashing, mailbox overflow, timing issues, multi-tasking-safety.
Maybe bitbus is sort of network protocol?
the point is:
you might have maybe 20 NXTs in your network and everyone has to send and to receive and there are urgent requests and direct commands and many messages of major or minor significance cross over from any to any.
And the connection is only half-duplex.
So the problem first of all is to prevent messages from crashing (2 NXTs must not send at the same time never!) and to canalize the msg traffic in a way that only 1 NXT can send at 1 time and all the others have to listen. Then the next NXT in line is to send.
So my approach first of all would be to establish a token ring network.
For the TR many problems may occur, e.g., what if the NXT which should get the token next is suddenly offline (low batteries, loose connection)? (my suggest: heart beat signals as signs of life, and time-outs to pass the token to the next after the next).
How can a NXT know which is the next in line, and the next after the next (and the next after this one)? (my suggest a member list of all members - but static or dynamic...?)
What if one NXT is addressed to send a value or an acknowlege message but he doesn't reply - how often should the request be sent, when should the traffic be cancelled?
What about urgent messages or commands - should there be established sort of "Red Telephone Line" for quick request-response-messages with tokens sent back and forth regardless of other members of the ring?
What if - let's say - NXT No.20 gets lots of requests and data messages of all 19 other NXTs in the ring, maybe over all 4 dozens - how to prevent his inbox from overflow? Remember, he can't reply while he hasn't got the token (my suggest: a big 2nd-level FIFO-inbox buffer, an inbox thread quickly clearing the inboxes, and a big outbox-FIFO-stack to gather the outgoing messages until it's his turn).
What if 1 NXT is online again if he was offline at times? How can he join the runnning queue again (e.g., if he got new batteries)?
What if the NXT which got the token suddenly hangs up so that he can't pass the token to any other any more? Who will fill in for him?
What if a new NXT No.21 wants to join the ring which had not been integrated before? Can the ring be dynamically enlarged?
So this is the footing of all message traffic: a network operation system. If it works for 20, it will also work for 3 or 32, and it will work both for rs485 and for nxtBee (and maybe partly also for BT).
If that once works fine we can talk about how the messages can be addressed safely and detected and interpreted reliably and about better error detection algorithms.
But I think for this purpose the 8-byte-message-header described above could be a very good start.
regards, HaWe aka Ford"A Kingdom of Heaven if NXC had recursions" Prefect
±≠≈αγδελπφωΔΦΣΩ∫√∈∉¬⊂⊄∩∪∅∞
NXC CHESS for NXT: url= http://www.mindstormsforum.de/viewtopic.php?f=70&t=6790
wishful for NXC: easy + trouble-free network & I/O remote control for rs485, Xbee, and BT !