Hello everyone!
I am trying to write an user program with “i2c” API to get acceleration value from tag unit. I set my network with 1 initiator anchor and 1 tag. I found 2 problems about these acc values.
- When I use “av” shell command in Tara Term via USB connection, I can receive acc vlaues. However, I can’t understand these values. When the tag stay still, It seems that X has a mean value as 16400 while Y is 0 and Z is 100 or so. I have some data at below.
acc: x = 16448, y = 0, z = 208
acc: x = 16192, y = 48, z = 192
acc: x = 16416, y = 0, z = 48
acc: x = 16080, y = -80, z = 240
I dont understand why the X axis has such a big value. Does this X value include gravitational acceleration?
And What does these 3 axis mean? In what direction?Is the X axis straight down?
-
I tried to code with “dwm_i2c_read” API to get acc value. This is my code:
**uint8_t data[6];**
** dwm_i2c_read(0x33 >> 1, &data, 6);**
** printf(“acc data=%d, %d, %d, %d, %d, %d\n”, data[0], data[1], data[2], data[3], data[4], data[5]);**
As u can see, I try to read acc vlaues from acclermeter, whose ID is 0x33. I want to keep these value in pointer data[]. Every two bytes of data represents the acc value of an axis.
Sometimes, I can get 6 bytes data like: acc data=64, 64, 0, 192, 0, 32
With base conversion it equals to 16448,192,32. which is approximately equal to what I receive with “av” Shell Command.
However, I would receive data out of order more often, like following:
acc data=254, 112, 64, 128, 0, 144 equals to 65136,16512,144
acc data=96, 64, 64, 0, 128, 254 equals to 24128,16384,33022
acc data=64, 48, 0, 144, 254, 32
acc data=0, 0, 96, 254, 32, 64
There is only few line with correct order (at least 64 is the first byte I think). Is there anyone can help me with this “dwm_i2c_read” API usage? Can u find any clue in my code or anyone can show me his code?
Thank you very much!