Serial (RS232) Protocol

VB3i Serial String Format
115200 Baud, no parity, 8 data bits, 1 stop bit
Message format:
$VBOX3i,nnnn0000,stttaaaaoooovvhheeezzyyxxffffjjjj1111222233334444lpddddddqqrrii77778888kkmmmgggg559966cc
The $VBOX3i and commas are in ASCII, the rest is in binary.
Although not all of the channels listed below are present in the serial stream unless selected in VBOX Setup software, the table shows the order in which they appear in the data stream
Enter first 4 bytes (nnnn) as 8 characters of hexadecimal:
Format | Bytes | Description | nnnn, bit mask. | |
---|---|---|---|---|
nnnn | 4 | Reserved to indicate channel presence | ||
0000 | 4 | Reserved | ||
s | Integer | 1 |
Satellites Number of satellites |
0x00000001 |
ttt | Integer | 3 |
Time Number of 10 ms ticks since midnight UTC |
0x00000002 |
aaaa | Signed | 4 |
Latitude (MMMM.MMMMM * 100,000) Signed Integer of Decimal minutes *100,000. Positive = North, Negative = South |
0x00000004 |
oooo | Signed | 4 |
Longitude (MMMMM.MMMMM * 100,000) Signed Integer of Decimal minutes *100,000. Positive = West, Negative = East |
0x00000008 |
vv | Integer | 2 |
Velocity Velocity in Knots * 100 |
0x00000010 |
hh | Integer | 2 |
Heading Degrees from true north * 100 |
0x00000020 |
eee | Integer | 3 |
Height Altitude. In metres WGS84 * 100 True signed 24 bit number |
0x00000040 |
zz | Signed | 2 |
Vertical Velocity Vertical velocity in m/s * 100 |
0x00000080 |
yy | Signed | 2 |
Lat acc (GPS) Lateral acceleration in g * 100 |
0x00000100 |
xx | Signed | 2 |
Long acc (GPS) Longitudinal acceleration in g * 100 |
0x00000200 |
ffff | Integer | 4 |
Brake Distance (m *12800) |
0x00000400 |
jjjj | Integer | 4 |
Distance (m *12800) |
0x00000800 |
1111 | Float | 4 | Internal analogue ch1 | 0x00001000 |
2222 | Float | 4 | Internal analogue ch2 | 0x00002000 |
3333 | Float | 4 | Internal analogue ch3 | 0x00004000 |
4444 | Float | 4 | Internal analogue ch4 | 0x00008000 |
l | Integer | 1 |
GLONASS satellites Number of GLONASS satellites |
0x00010000 |
p | Integer | 1 |
GPS satellites Number of GPS satellites |
0x00020000 |
dd | 2 | Reserved | 0x00040000 | |
dd | 2 | Reserved | 0x00080000 | |
dd | 2 | Reserved | 0x00100000 | |
Integer | 2 | VBOX Serial Number | 0x00200000 | |
rr | Integer | 2 | Kalman Filter Status | 0x00400000 |
ii | Integer | 2 | Solution Type | 0x00800000 |
7777 | Integer | 4 |
Velocity Quality km/h * 100 |
0x01000000 |
8888 | Signed | 4 | Internal Temperature | 0x02000000 |
kk | Integer | 2 | CF Buffer size | 0x04000000 |
mmm | Integer | 3 |
RAM Address Free space on CF *980991 = Full, 0 = Empty |
0x08000000 |
gggg | Float | 4 | Event time 1 | 0x10000000 |
55 | Float | 2 | Event time 2 | 0x20000000 |
99 | Integer | 2 | Battery 1 Voltage | 0x40000000 |
66 | Integer | 2 | Battery 2 Voltage | 0x80000000 |
cc | 2 | Checksum CRC of message, See Note 1* |
Note: ffff - Brake Distance: After the initial trigger activation, any new trigger activations within 2 seconds are ignored. After 2 seconds, if speed >2.7 km/h, new trigger input will reset the Brake Distance counter.
NEWCAN Serial String Format
When CAN channels are also selected to be present in the Serial data stream the data stream will look like the following:
$VBOX3i,nnnn0000,stttaaaaoooovvhheeezzmmmggggcc$NEWCAN,####,1111.....WWWWXX
$NEWCAN,####,1111.....WWWWXX is the additional CAN channel information to the serial data stream.
The XX is a two byte checksum. - This is the same format as before see NOTE 1 below
The format for the serial string is $NEWCAN,####,1111.....WWWWXX
Where #### is a 32-bit value, representing the number of bytes to follow.
The order in which the data will come across depends upon the order in which you select the channels from the set-up screen. For example if the first channel you choose to log is FIM Channel 1 then the first 4 bytes will contain the data from the FIM. If the second channel was ADC02 Channel4 then the next 4 bytes will contain data for the ADC02. If you then remove (choose not to log) FIM Channel 1 and select ADC02 Channel 1 then the first 4 bytes will now contain the data for ADC02 Channel 1.
The data transmitted for each channel is in a standard IEEE 32 bit Float format.
Bytes | Description | Bit mask | |
---|---|---|---|
ffff | 4 | CAN channel 15 | 0x7FFF |
$NEWCAN | 7 | String header | |
#### | 4 | Reserved to indicate channel presence | |
, | 1 | comma separator | |
1111 | 4 | CAN channel 1 | 0x1 |
2222 | 4 | CAN channel 2 | 0x3 |
3333 | 4 | CAN channel 3 | 0x7 |
4444 | 4 | CAN channel 4 | 0xF |
5555 | 4 | CAN channel 5 | 0x1F |
6666 | 4 | CAN channel 6 | 0x3F |
7777 | 4 | CAN channel 7 | 0x7F |
8888 | 4 | CAN channel 8 | 0xFF |
9999 | 4 | CAN channel 9 | 0x1FF |
aaaa | 4 | CAN channel 10 | 0x3FF |
bbbb | 4 | CAN channel 11 | 0x7FF |
cccc | 4 | CAN channel 12 | 0xFFF |
dddd | 4 | CAN channel 13 | 0x1FFF |
eeee | 4 | CAN channel 14 | 0x3FFF |
, | 1 | comma separator | |
gggg | 4 | CAN channel 16 | 0xFFFF |
hhhh | 4 | CAN channel 17 | 0x1FFFF |
iiii | 4 | CAN channel 18 | 0x3FFFF |
jjjj | 4 | CAN channel 19 | 0x7FFFF |
kkkk | 4 | CAN channel 20 | 0xFFFFF |
llll | 4 | CAN channel 21 | 0x1FFFFF |
mmmm | 4 | CAN channel 22 | 0x3FFFFF |
nnnn | 4 | CAN channel 23 | 0x7FFFFF |
oooo | 4 | CAN channel 24 | 0xFFFFFF |
pppp | 4 | CAN channel 25 | 0x1FFFFFF |
qqqq | 4 | CAN channel 26 | 0x3FFFFFF |
rrrr | 4 | CAN channel 27 | 0x7FFFFFF |
ssss | 4 | CAN channel 28 | 0xFFFFFFF |
tttt | 4 | CAN channel 29 | 0x1FFFFFFF |
uuuu | 4 | CAN channel 30 | 0x3FFFFFFF |
vvvv | 4 | CAN channel 31 | 0x7FFFFFFF |
wwww | 4 | CAN channel 32 | 0xFFFFFFFF |
ZZ | 2 | Checksum |
32 bit Float numbers
The bit pattern b1b2b3...b9b10b11...b32 of a word in a 32-bit machine represents the real number
(-1)s x 2e-127 x (1.f)2
where s = b1, e = (b2...b9)2, and f = b10b11...b32.
Note that only the fraction from the normalized mantissa is stored and so there is a hidden bit and the mantissa is actually represented by 24 binary digits.
Example of the Fraction part of the calculation the 23 bits 01110111100110110011110 would be come 1. 01110111100110110011110
The 23 bits after the 1. represent the presence of the binary weighted fractions ,½, ¼, 1/8, 1/16, 1/32,1/64 etc.
*Note 1
CRC Calculation example :
s[n] is a string containing the message
Polynomial:= 4129
CRC:=0;
for Loop:=1 to Length(s) do
begin
Temp:=s[Loop];
CRC:= CRC xor (integer(Temp) * 256);
CRC:= CRC mod 65536;
for i:=7 downto 0 do
begin
if ( (CRC and 32768)=32768) then
begin
CRC:= CRC *2 ;
CRC:= CRC xor Polynomial;
end
else
begin
CRC:= CRC *2 ;
end;
CRC:=CRC mod 65536;
end;
end;
result:=CRC;