The firmware guide walks through how to read the position (presumably relative to a spatial arrangement of DW1000 chips all distance-ranging or otherwise self-locating relative to one another, I’m just assuming). Oddly, I just get 4 0s back for x,y,z, and qf, no meaningful data. Perhaps someone has some thoughts on that, although it isn’t my primary question here.
In shell mode, I can run “av” to get back accelerometer values and these seem to actually contain meaningful data, as they indicate the orientation of the device as I rotate it around in the air calling av over and over again.
But I can’t find an API call for the motion sensor. I looked through dwm.h and through the API guide and I can’t find any way to read the accelerometer from C code, as demonstrated for position in the FW guide. The position example from the firmware guide is fairly straightforward (except for the confusion that that it just returns solid 0s), but I can’t find anything for the accelerometer.
What am I missing?
Have you had a look at the dwm1001-api-guide document ?
The accelerometer is connected to the two wire interface (I2C), so you need to use the api dwm_i2c_read.
I would try something like :
const uint8_t addr = 0x33; // some address of the slave device
dwm_i2c_read(addr, data, 2);
Let me know how it goes,
In the user code of the DWM1001, I would like to read some registers from another sensor connected to the I2C bus.
If I use the function:
“dwm_i2c_read(uint8_t addr, uint8_t* p_data, uint8_t len)”
addr: is the device address (0x33 for the inboard accelerometer)
p_data: pointer to the received data buffer
len: number of bytes
BUT, I do not know how to specify which register address I want to read!
Any help on this is wellcome.
Any comment on this?
Is there a way to read registers from another sensor connected to the I2C bus?
I do not see any parameter for the register address in the function ‘dwm_i2c_read(device address, *data, len)’?
Thank you and best regards
I guess the register address should be within the data. What is the sensor you’re trying to read from ?
Two sensors: Bosch BME280 and TDK MPU-6050.
Also, is there any sample code to configure, in the user code area, the Nordic pins for analog mode, and read some analog values?
We don’t have such an example at the moment. Please have a look at the nordic examples from their SDK as a starting point.
Did you get read other sensors connected to the I2C bus?
Where can I find the accelerometer’s Register Map?
A doubt about the code:
In the sample project
dwm_simple the code snippet is:
/* Test the accelerometer */
i2cbyte = 0x0f;
rv = dwm_i2c_write(0x33 >> 1, &i2cbyte, 1, true);
Why the right shift in address?
code snippet from sample-project dwm-api-test.c:
> #define LIS2DX_SLAVE_ADDR 0x19 /* I2C slave address */
> #define LIS2DX_WHO_AM_I 0x0F /* Who I am ID */
> #define LIS2DX_WHO_AM_I_VAL 0x33 /* ID value */
0x33 >> 1 =
so it seems to be a kind of humor…
Thanks for your guide. I have tried these code you offered in dwm_simple.c. But I dont obtain correct data. I printf the value stored in array data and data. As I know, for each axis there are 2 bytes data. Hence I combine data0 and data1and regard as acc value for one axis data. However, when my unit keeping still, the output data is unstable. Looks like ramdom value rather than anything requested by “av” command.
Could you please give any idea?
Great thank to you.