View Single Post
  #1   Spotlight this post!  
Unread 18-01-2017, 11:42
codeman73 codeman73 is offline
Registered User
FRC #1024
 
Join Date: Jan 2017
Location: Indiana
Posts: 1
codeman73 is an unknown quantity at this point
pixy serial byte stream sometimes offset by a byte?

We are reading the serial stream with I2C. We've got the serial protocol figured out and have been able to decode the object data, most of the time. But sometimes it seems like the bytes in the data stream are offset by a byte. We could deal with it, if they were offset to the right, i.e. preceeded by a zero. Then we could just skip the first byte. But it's the other way around. It looks like the first byte we read is the sync word, but truncated.

For example, in a correct stream, we see the following:

0xaa55,0xaa55,checksum,signature, etc

But instead we see

0x55aa,0x55-then first byte of checksum

Yes we know about the little-endian-ness and are reading that correctly.

I searched a bit here first and found http://www.cmucam.org/projects/cmucam5/wiki/RoboRIO. The RoboRio code there seems to handle a similar condition. They look for

PIXY_START_WORDX 0x55aa

instead of the expected

PIXY_START_WORD 0xaa55

and then they just read a byte. But then wouldn't you be losing that first sync word, or everything following that would be off by a byte?

Any suggestions?
Reply With Quote