cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read any register on the LIS2DW12

GTS.1
Associate III

Hi,

I'm trying to interface a nrf52840 DK with a LIS2DW12. I'm using the ST-Eval board for the IMU.

I'm able to read the WHO_AM_I register and it gives the correct value(0x44). I tried setting the IMU to 100Hz and the high performance mode. When i tried to read the CTRL1 and CTRL6 registers, it returns a 0.

Is there any specific sequence the ODR and power modes must be set?

Thanks ​

1 ACCEPTED SOLUTION

Accepted Solutions

Hi Eleon,

It was an issue on the Nordic side code. Our write function had been implemented as two separate I2C transactions, the first one to write the register address and the second to write the data to the register. This had included a repeated start between each write. This had caused the issue. A single, continuous write has fixed the issue.

Thanks

View solution in original post

4 REPLIES 4
GTS.1
Associate III

Hi,

I swapped out my nrf52840 DK with a Nucleo-G071RB and it worked perfectly fine. I was able to read the accelerometer data.

This is the configuration I have used

lis2dw12_device_id_get(&dev_ctx, &who_am_i);
    
    /* Restore default configuration */
    lis2dw12_reset_set(&dev_ctx, PROPERTY_ENABLE);
 
    do {
      lis2dw12_reset_get(&dev_ctx, &rst);
    } while (rst);
 
    /* Enable Block Data Update */
    lis2dw12_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);
    /* Set full scale */
    //lis2dw12_full_scale_set(&dev_ctx, LIS2DW12_8g);
    lis2dw12_full_scale_set(&dev_ctx, LIS2DW12_2g);
    /* Configure filtering chain
     * Accelerometer - filter path / bandwidth
     */
    lis2dw12_filter_path_set(&dev_ctx, LIS2DW12_LPF_ON_OUT);
    lis2dw12_filter_bandwidth_set(&dev_ctx, LIS2DW12_ODR_DIV_4);
    /* Configure power mode */
    lis2dw12_power_mode_set(&dev_ctx, LIS2DW12_HIGH_PERFORMANCE);
    //lis2dw12_power_mode_set(&dev_ctx, LIS2DW12_CONT_LOW_PWR_LOW_NOISE_12bit);
    /* Set Output Data Rate */
    lis2dw12_data_rate_set(&dev_ctx, LIS2DW12_XL_ODR_25Hz);

I took this code snippet from one of the examples in the driver repo.

I'm still unable to figure out why the nrf52840 is receiving zeros but the Nucleo is able to read the data. Just a reminder that I was able to read the WHO_AM_I register with the nrf52840.

Both the images I have attached are the logic analyzer output when used with the nrf52840 DK. You can see that it's able to read the CTRL1 register but not the data from the output data registers.0693W00000NpkvHQAR.png0693W00000NpkvMQAR.pngIt seems like as if the I2C writes to the lis2dw12 is not working properly with the nrf52840.

Any help with this would be really appreciated.

Thanks

Hi @GTS.1​ ,

The accelerometer seems working well. You should check from nrf52840 side (Nordic Semi support).

-Eleon

Hi Eleon,

It was an issue on the Nordic side code. Our write function had been implemented as two separate I2C transactions, the first one to write the register address and the second to write the data to the register. This had included a repeated start between each write. This had caused the issue. A single, continuous write has fixed the issue.

Thanks

Hi @GTS.1​ ,

glad to see you solved the issue!

-Eleon