Help with serial I/O
mynet43
Posts: 644
I have a new board, with serial I/O coming in thru a MAX232 chip. I'm going to run it at 57600 baud.
Here's my issue. I'm receiving I/O from a PC, acting as master. The format of the messages is:
Regular messages:
<SOH>[ID][LENGTH][CMD][PARAM1][PARAM2]...[PARAMn][CRC16]<EOF>
ACK/NAK:
<SOH>[ID][LENGTH][CMD][CRC16]<EOF>
Two questions:
1. Can someone recommend a driver that supports this SOH/EOF format? Or do I need to modify an existing driver?
2. Is there an available CRC16 routine for this type of message?
Thank you for your help and support.
Jim
Here's my issue. I'm receiving I/O from a PC, acting as master. The format of the messages is:
Regular messages:
<SOH>[ID][LENGTH][CMD][PARAM1][PARAM2]...[PARAMn][CRC16]<EOF>
ACK/NAK:
<SOH>[ID][LENGTH][CMD][CRC16]<EOF>
Two questions:
1. Can someone recommend a driver that supports this SOH/EOF format? Or do I need to modify an existing driver?
2. Is there an available CRC16 routine for this type of message?
Thank you for your help and support.
Jim
Comments
I've done something similar in C for an ARM device, using a 32-bit CRC. It was quite easy.
2) I'm not aware of any, but there are lots of examples available with a web search. Look at the Wikipedia.
Thanks for the quick update. I was afraid of that. Not too difficult, just one more thing...
If anyone else has done some of this, please let me know. Also the CRC16.
Thank you for your help.
Jim
Are you saying to just use the RX routine to grab bytes and do the checking myself?
I'm used to receiving strings terminated by CR, etc.
Thanks for the help.
Jim
Check this out for size.
What device are you using? Maybe someone on the forum has already written code for it.
According to ASCII <SOH> (start of header) would be 1. I didn't see an ASCII for
<EOF> (I'm guessing end of file). There is an <EOT> (end of transmission) 4.
Duane
Your comm protocol has some similarities to the YMODEM protocol. It uses SOH, EOT and a 16-bit CRC. My YMODEM routines are attached below. They are spinix apps, but I think it contains some of the basic code that you need. Let me know if you have any questions.
Dave
BTW, the attached programs are based on a thread that Rayman started in the old forum about YMODEM.
@Duane - I think you're right about the EOF vs EOT. The EOT makes sense, the EOF was in the spec I received from my customer. Probably a typo.
@ Bruce and Dave - Thanks for the software! I'll look at all of them. I think you just saved me some precious time.
Thanks again for the help and support.
Jim