Understanding packet data format
Hey OpenBCI community,
I'm trying to understand the serial interface here so I can write a module for openFrameworks and Unity.
I see this is the (ideal) format:
0: Start_char 0xA0
1: Length of payload
2-5: Sample number
6-9: Chan0
10-13: Chan1
14: Chan2
18: Chan3
22: Chan4
26: Chan5
30: Chan6
34-37: Chan7
38: End_char 0xC0
So I print out the size of packets I see, and it's 95% like this. However, I'm seeing a handful of length 6 packets (which I could probably understand) but also a spattering of bogus sizes. 17,18, 27.
Any ideas for what this might be?
Cheers,
Dan
I'm trying to understand the serial interface here so I can write a module for openFrameworks and Unity.
I see this is the (ideal) format:
0: Start_char 0xA0
1: Length of payload
2-5: Sample number
6-9: Chan0
10-13: Chan1
14: Chan2
18: Chan3
22: Chan4
26: Chan5
30: Chan6
34-37: Chan7
38: End_char 0xC0
So I print out the size of packets I see, and it's 95% like this. However, I'm seeing a handful of length 6 packets (which I could probably understand) but also a spattering of bogus sizes. 17,18, 27.
Any ideas for what this might be?
Cheers,
Dan
Comments
https://github.com/OpenBCI/OpenBCI/wiki/Data-Format-for-OpenBCI-V1-and-V2
Based on looking at the packet counter (sample number) you can confirm that you're getting all of the packets (not too many, not too few). So, if you're getting partial packets (or packets with too many bytes), you can look at the broken packet's counter to see if it is in sequence or not.
Also, you could try interpreting the broken packet as ASCII. The current Arduino software does spit back ASCII text in response to many commands (such as dactivating channels). So these "broken" packets might actually be text messages.
Finally, if you're not interested in recreating the binary parsing functions from scratch, you can get a C/C++ version from the BrainBay code (discussed <a href="http://eeghacker.blogspot.com/2014/01/openbci-driver-in-brainbay.html">here</a>
Let me know if you figure it out!
Chip