I have 4 anchors and 1 tag which are all connected to the same network and are configured appropriately. For my use case, I want the tag to send the measured distances to my mobile via BLE.
In order to achieve this, the API Guide says in section 7.1.3 that location data mode has to be set to 1.
Therefore, after setting that value to 1, the way I understood the slightly confusing table is that I should expect 29 bytes to be received from my tag. 1 byte is the distance count and for every anchor I should receive 7 bytes where the first two bytes represent the node id and the following 5 bytes the measured distance and quality factor. So for 4 anchors it should be: 1 + 4 x 7 bytes = 29 bytes, right?
My problem is that I only receive 20 bytes per packet. By looking into the data it looks like some data is missing.
Btw, when setting location data mode to position data only, I receive 14 bytes and as such I am able to compose the values into integers. But when I set location data mode to Position and Distance mode (mode 2), I also only receive 20 bytes per packet. It seems to be a connection limit that no more than 20 bytes can be transferred.
Can anybody point me into the right direction?
Thanks in advance,
I’ve already found the solution.
I’ll keep the thread alive so people with similar problems can see my solution.
The problem was not caused by my DWM1001 Dev-Kit but by my mobile phone which runs Android. Android OS by default has a Bluetooth Low Energy MTU of 20 bytes. Once someone wants to establish a connection to a remote Bluetooth device, one can call BluetoothGatt.requestMtu(MTU) and receive a callback with onMtuChanged(). I simply set the MTU for my case to 33 and now I am able to receive 30 bytes per packet.
For some reason, setting the MTU to 30 is not enough. Then I only receive 27 bytes per packet. It seems like 3 bytes are reserved for headers or something similar.
Follow these links for further information:
Hello, I have set location data characteristic to position data only and from the documentation it say only x,y,z and quality factor (total 13 bytes) but why I receive 14 bytes?
Why there is special character such as % or ’ inside the byte-array that I received from the UUID?
I am facing a similar issue. I have set the Location Mode to 2 (Position & Distance) and I am getting 43 bytes instead of 42 bytes (13 bytes Position + 29 bytes Distance = 42 bytes)!
Sorry for the delay,
it’s been a while since I worked with this stuff but I believe that the very first byte can simply be ignored. Index 0 may refer to the mode you set or - even more simple - just contains success (0 or 1).
Again, I am not very sure about it but I can tell you that that Index 0 can easily be ignored since it does not contain the information we want. The data you want to access starts at Index 1.
Another problem experiencing here is that the lowest byte is not reliable writing/reading out of the gatt. e.g. for the characteristic of anchor positions, each field (of x, y, z) is an int object (4 bytes). The lowest if you write some bytes like 0xABCD1234 from Android into DWM1001-Dev, you read it out like 0xEECD1234 (0xEE could represent any erroneous values). I have tested this a lot and it seems like a very disappointing problem when precision is needed.