10-5
Communication Protocol
10
Checksum Calculation:
Checksum is calculated for the entire frame by adding
the bytes from packet header to Byte N. If the checksum value exceeds 16 bits
(greater than 0xFFFF), then the MSB 16 bits are added to the LSB 16 bits, until the
MSB 16 bits become zero.
E.g.
1. If Calculated checksum = 0x0000A1B2, then the final checksum = 0xA1B2
2. If calculated checksum = 0x0F1FFEEC, then the final checksum is calculated as
follows
Add 16 bits MSB to 16 bits LSB -
0x0F1F
------------
0x10E0B (Intermediate result 1)
------------
As the intermediate result 1 is greater than 0xFFFF, MSB 16 bits is added again
to LSB 16 bits
0x0E0B
+
0x0001
------------
0x0E0C
(Intermediate
result
2)
------------
As the intermediate result 2 is lesser than 0xFFFF, the Final checksum would be
0x0E0C
10.3.1 Communication Between Smartphone And UWBT Probe
The master initiates the data transfers by sending request as string. On receiving
the request, the slave will respond with appropriate frame. In case the slave does
not respond for the request, the master waits for 100ms and resends the same
string. The master will send the same request 5 times and if it does not receive
any reply from slave, it displays message indicating “communication failed”.
In case, if slave sends Negative or Busy Acknowledgement, the master sends the
same request 5 times. If the master does not get positive response from device, it
indicates the user “Communication failed”.
Figure 10-1 - Slave responding with Acknowledgement
ACK
Data request
Slave
Master