View previous topic :: View next topic |
Author |
Message |
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
|
Posted: Mon Feb 13, 2006 12:50 pm |
|
|
Kamal wrote: | Excellent !
The protocol definition seems generic enough, altough I think that if we are going to use handshaking (initally software - say XON/XOFF) then we also need to number the ACKs ? This will help us deal with delayed ACKs and lost packets - what do you think ? |
i think you may be overcomplicating things here. remember "KISS" -- it's easier to design, code, and debug. if you want to use XON/XOFF you have to escape any payload values that correspond with XON/XOFF. this in turn complicates packet construction, checksumming, and capture. really, for reasonable size packets (4 to 32 bytes) at reasonable speeds (1.2-57.6Kbps) there should be no need to use any kind of flow control, SW or HW. the PIC can manage this throughput just fine, and of course the PC can as well.
jds-pic |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
Re: Towards a reliable Serial comm. lib over long distances |
Posted: Mon Feb 13, 2006 1:01 pm |
|
|
kender wrote: | jds-pic wrote: |
example, an 8 byte packet:
byte 1: target node
byte 2: source node
byte 3: opcode (aka command byte)
byte 4: payload byte 1
byte 5: payload byte 2
byte 6: payload byte 3
byte 7: payload byte 4
byte 8: checksum
|
Hey JDS,
I'm probably missing a piece here... I assume this was a binary (as opposed to ASCII) protocol. How did you signal the beginning or the end of the packet? Did you send a break? Did you have additional handshake lines? Was the protocol strictly synchronous, and the PIC would not talk unless it was queried? |
yes, it's a binary protocol. there is no problem with identifying the start of the packet; it's the first byte on the wire.
there are no additional handshake lines required; it works perfect with 2 wire (half duplex) or 4 wire (full duplex) RS422 or RS485. for that matter it works perfect with RS232 as well.
kender wrote: |
I have some code and specs for a ASCII protocol, where all data was sent as hex-ASCII. E.g. the number 254 would be sent as a pair of characters "FE" (2 bytes). |
uggh! why would you go through this pain? to make the on-wire communications human readable? keep it binary, it's simple and you don't have to do any extraneous conversions at the sender or receiver. this is just "make work" activity, and of course it increases latency and decreases throughput at the same time.
kender wrote: | Packets had variable length. |
that's ok, you just need to carry another header field for that.
kender wrote: |
'$' character was a start marker. |
you could define a specific start marker or you can write a state machine with a packet capture timeout function.
kender wrote: | As an ASCII protocol it had a lower throughput, but on the up side was easy to code and debug. It also required minimal hardware - just RS-232 with TX and RX. |
my packet scheme above works with 2 wire (tx + rx) RS232 fine as well. you just need to use a decent terminal program that shows you what's REALLY on the wire (which rules out HyperTerminal).
if you convert everything to ASCII you are going to incur a lot of issues. it's not necessary and is an unneeded layer of abstraction. in the field, the node to node communications don't need ASCII. it's just a nicety for debugging, and i'm not even sure how much it really helps.
jds-pic |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
Re: Towards a reliable Serial comm. lib over long distances |
Posted: Mon Feb 13, 2006 1:49 pm |
|
|
jds-pic wrote: | ...i'm not even sure how much it [ASCII protocol] really helps. |
The single most helpful thing was the ability to choose an unambiguous start marker. That's pretty much all. |
|
|
Kamal
Joined: 11 Feb 2006 Posts: 12
|
OK. Let's make a few tradeoffs and start workin |
Posted: Mon Feb 13, 2006 5:23 pm |
|
|
Let's see, what do we have here..
Here's what I think we should start with (and fast) :
1. Preferably full duplex serial point-to-point communication with NO FLOW CONTROL over RS422
2. A nice and simple BINARY protocol
3. No multidrop (RS485) at the moment
4. Error detection using CRC8
And I have been asking over and over again - when do we start ? We have 2 pages of just ideas with <i>nothing</i> to show for it ;)
It's getting scary ! Let's move some arse here |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
Re: OK. Let's make a few tradeoffs and start workin |
Posted: Mon Feb 13, 2006 5:53 pm |
|
|
Kamal wrote: |
It's getting scary ! Let's move some arse here |
says the guy who has contributed 6 posts to the forum and other than a set of requirements hasn't provided any useful info to this thread.
you should be a project manager!
above, see my code for the CRC8 routine.
above, see my (admittedly incomplete) protocol spec.
above, see my ideas for KISS.
what, mr project manager, are you working on right now?
what, mr project manager, are the next steps for the group?
jds-pic |
|
|
Kamal
Joined: 11 Feb 2006 Posts: 12
|
Re: OK. Let's make a few tradeoffs and start workin |
Posted: Mon Feb 13, 2006 6:53 pm |
|
|
jds-pic wrote: | Kamal wrote: |
It's getting scary ! Let's move some arse here |
says the guy who has contributed 6 posts to the forum and other than a set of requirements hasn't provided any useful info to this thread.
you should be a project manager!
|
You just wait ;) When I get started, I code like craazy..
But jds-pic, on a serious note, if I irritated you, I am really sorry. I just want to discuss with you guys a good design on which I can get started as well as stop an end to the RS232/serial communication problem as well.
But I really wanted to get started fast. Sorry if I put you off.
jds-pic wrote: |
above, see my code for the CRC8 routine.
|
Undoubtedly <i>very</i> useful. I myself said this on this thread !
jds-pic wrote: |
above, see my (admittedly incomplete) protocol spec.
|
I was reading it and it's great. Infact, if you don't have any problem, I wish to modify it a bit and start working on it.
Thanks <b>jds</b>. And sorry again for being to pushy. It's just that we were having such a great conversation, I got excited and hyperactive ;) |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
Re: OK. Let's make a few tradeoffs and start workin |
Posted: Mon Feb 13, 2006 7:25 pm |
|
|
Kamal wrote: |
I just want to discuss with you guys a good design on which I can get started as well as stop an end to the RS232/serial communication problem as well. |
and that is my goal as well. let's proceed.
jds-pic |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Mon Feb 13, 2006 11:34 pm |
|
|
Kamal wrote: | By the way, we should start with a good design soon and have a prototype in our hands within <i><b>this week</b></i>. |
Kamal,
I have to point out that it's more difficult to develop something that's actually reusable under pressure of a deadline. We clearly have two separate problems here.
1. Business problem. Your butt is on the line for a prototype this week.
2. Technical problem. As far as I know (please prove me wrong), there is no good point-to-point packet protocol. For multidrop we have MODBUS, CAN and JSD's CBUS.
We might solve the second one within this forum, but it will take more than a week, because we are doing it in the leisure time.
Sincerely,
Nick |
|
|
jds-pic
Joined: 17 Sep 2003 Posts: 205
|
Re: OK. Let's make a few tradeoffs and start workin |
Posted: Tue Feb 21, 2006 3:34 pm |
|
|
Kamal wrote: |
You just wait ;) When I get started, I code like craazy..
|
kamal,
how is the code coming?
what areas need to be worked on?
jds-pic |
|
|
ThomasC
Joined: 09 Oct 2007 Posts: 62
|
|
Posted: Fri Jan 25, 2008 1:32 pm |
|
|
Nice progress =) |
|
|
ELCouz
Joined: 18 Jul 2007 Posts: 427 Location: Montreal,Quebec
|
|
Posted: Thu Jan 28, 2010 11:31 am |
|
|
Sorry to revive this old thread from the graveyard.
But it would be very nice if the OP could post is work as he promised.
This is a very good topic but no example of code I've been demonstrated :( _________________ Regards,
Laurent
-----------
Here's my first visual theme for the CCS C Compiler. Enjoy! |
|
|
Guest
|
|
Posted: Sat Jan 30, 2010 10:22 am |
|
|
I'm reminded of the adage "people who don't know history are condemned to repeat it".
This thread has that in spades.
Has nobody here been alive and working as far back even as the early
90's? ever read the SONY P2- ancient RS-422 protocol for ideas?
Let alone read the TREASURE trove of info you can get with a google of:
RS-422 address protocol guide
I've worked with a number of these standards you will find
and more than one, as is,
will satisfy the original request - with excess capability too.
If it's just the fun of rediscovery of what the ancients already did -- then by all means plow that field again folks. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Jan 30, 2010 10:26 am |
|
|
Please add my vote to what 'guest' said above.
This is much ado about settled technology.
Just what we need one more home made non-standard protocol.
that NO PRO in their right mind will ever adopt.
I am not being unkind here - just rational -
I second the motion - have fun - but don't expect anyone to
use the end product except those invested in its creation. |
|
|
|