Sync byte detection

Up to System integration and telemetry

Sync byte detection

Posted by Chris Lovera at November 19. 2009

Hello,

I am integrating an Aquadopp current profiler into a system that requires us to collect data via a controller, so we have written some driver code to do data collection.

Occasionally, the record ID and record size appear to be invalid (e.g. record size<0, or record types that don't correspond to the documented types).

There are many things it could be, but one way this could possibly occur is if the sync byte appeared somewhere besides the beginning of a record.

Is there any possibility that the sync byte could appear as part of the data values (other than in the header)?

If so, can you recommend a strategy for rejecting false record starts?

Thank You,

Kent Headley

MBARI

headley@mbari.org

831.775.1822

Re: Sync byte detection

Posted by Sven Nylund at November 23. 2009

Hi Kent,

The sync byte may appear as a part for the data values so you have to account for that. After locating the sync byte you should then check the next byte to see if the ID is possible for the instrument in question. If it is you then read the length field and perhaps check for max/min values according to what is possible for the data formate associated with the current ID.  You then read in the rest of the data for that data record and test for correct checksum. If the checksum is correct all is fine, if it is not you should search for a new sync character, starting from position of what was assumed to be the length field.

Except for the very first time you connect to a ongoing stream of data where you may have to search for the correct sync character, you should not see any problems since each record will be directly followed by a new (actual) sync character.

Best regards,

Sven Nylund

Re: Sync byte detection

Posted by Chris Lovera at November 23. 2009

Hi Sven,

Thanks very much for your response; this seems like a good approach. In our system, we are pushing the processor quite hard, and I believe that serial characters are occasionally being dropped, so we must resynchronize the stream when that occurs. But the logic you describe sounds like it should work well.

Does the System Integrator Manual describe the checksum calculation,  possible ID values, and range of record sizes?

Thank You!

Kent

Previously Sven Nylund wrote:

Hi Kent,

The sync byte may appear as a part for the data values so you have to account for that. After locating the sync byte you should then check the next byte to see if the ID is possible for the instrument in question. If it is you then read the length field and perhaps check for max/min values according to what is possible for the data formate associated with the current ID.  You then read in the rest of the data for that data record and test for correct checksum. If the checksum is correct all is fine, if it is not you should search for a new sync character, starting from position of what was assumed to be the length field.

Except for the very first time you connect to a ongoing stream of data where you may have to search for the correct sync character, you should not see any problems since each record will be directly followed by a new (actual) sync character.

Best regards,

Sven Nylund

 

Re: Sync byte detection

Posted by Sven Nylund at November 27. 2009

Hi Kent,

Does the System Integrator Manual describe the checksum calculation,  possible ID values, and range of record sizes?

Yes, this is all described in the System Integrator Manual. For the range of record sizes you have to calculate this based on the maximum number of cells and beams that is possible or you can use any knowledge you may have of your planned configurations.

Best regards,

Sven

Powered by Ploneboard
Document Actions
Log in


Forgot your password?
New user?