I am measuring the systime every 100 ms. Although the difference between the times i receive are not constant. This is my code:
I get the data on the uart in hex. I convert them by taking the 12 chars and convert them to decimal.
these are some of the times:
I do not know why these are not consistantly around the 100 ms apart.
help would be appreciated.
There is something wrong with your conversion.
First - the numbers are not in order.
Second - I’ve converted your dec numbers back to hex and got
6 bytes actually, not 5.
Can you provide the raw hex data?
You are right, my bad…
Please correct me if i am wrong. When i request the systemtime of the dwm1000 module at a constant rate of once every 0.2008653333 s(measured with logic analyzer). These are a part of the responses:
So this are these values:
|Returned time of DWM1000
||Difference between times
Can someone explain these times? Why are these times not constant as they are requested a precise interval?
is it correct that these to assume that these are ticks of the 64 ghz clock. So that every tick is
1/(63.8976 * 1000000000) seconds long?
There are no messages coming in on the dwm1000, i use the function dwt_readsystime();
I use stm32f103RBT6 with a ported dw1000 library. And i use keil as an editor.
From you dump I can see the first 4 timestamps, so if I calculate 3 time differences.
So my conclusion is: you have two issues - with SPI reading and with converting raw timestamp data to decimal.
First - you read data seems to be correct except scaled twice (0.4s instead of 0.2s as expected) - read data is shifted one bit. I suggest check SPI clock/data polarity.
Second - you cannot simply concatenate decimal bytes to get a timestamp. It’s actually 5 binary octets, like uint8_t timestamp.
To get timestamp use this code (5 bytes don’t fit into standard uint32_t obviously):
uint64_t real_timestamp = (uint64_t)timestamp + (uint64_t)timestamp<<8 +
(uint64_t)timestamp<<16 + (uint64_t)timestamp<<24 +