cancel
Showing results for 
Search instead for 
Did you mean: 

problem with Lis2dw12 data ready interrupt.

MRive.2
Associate

Hi!

I'm using lis2dw12 on a custom board and trying to acquire the acceleration based on the data ready signal that I routed to INT1.

The code was based on this repository but I think I'm doing something wrong because I can't get any signal from the pin while mesuring it with an oscilloscope.

Here's my configuration of the device.

   lis2dw12_reg_t int_route;
 
	 /*
    * Restore default configuration
    */ 
		lis2dw12_reset_get(&dev_ctx, &rst);
		lis2dw12_reset_set(&dev_ctx, PROPERTY_ENABLE);
    do 
		{
	      
    } 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);
 
   /*
    * 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_CONT_LOW_PWR_LOW_NOISE_2);//LIS2DW12_CONT_LOW_PWR_12bit);
 
	 /*
    * Set Output Data Rate
    */
    lis2dw12_data_rate_set(&dev_ctx, LIS2DW12_XL_ODR_50Hz);//LIS2DW12_XL_ODR_100Hz);
		nrf_gpio_pin_set (ACC_nSS);
		
		// Enable data ready  interrupt
    int_route.ctrl4_int1_pad_ctrl.int1_drdy = PROPERTY_ENABLE;
    lis2dw12_pin_int1_route_set(&dev_ctx, &int_route.ctrl4_int1_pad_ctrl);
 
		nrf_delay_ms(10);

I've checked CTRL7 register and the "INTERRUPTS_ENABLE" bit is set. Aside from that could there be any other way to check if the configuration is correct?

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
niccolò
ST Employee

Hi @MRive.2​ ,

first of all, I would disable the BDU bit in CTRL2(21h), so that you see continuous data incoming.

I think you can use lis2dw12_block_data_update_set(&dev_ctx, PROPERTY_ENABLE); with PROPERTY_DISABLE or something like that.

then, can you confirm you are able to read output data by accessing the output registers?

Niccolò

View solution in original post

3 REPLIES 3
niccolò
ST Employee

Hi @MRive.2​ ,

first of all, I would disable the BDU bit in CTRL2(21h), so that you see continuous data incoming.

I think you can use lis2dw12_block_data_update_set(&dev_ctx, PROPERTY_ENABLE); with PROPERTY_DISABLE or something like that.

then, can you confirm you are able to read output data by accessing the output registers?

Niccolò

MRive.2
Associate

Hi @niccolo.ruffini​ ,

Thank you! It was precisely that! I checked CTRL2 register and BDU was indeed set, I just changed it with PROPERTY DISABLE and now I'm getting the interrupt signal.

Thanks!

Hi @MRive.2​ ,

you are welcome =)

remember that you can "select a best answer" to help other user that may have similar issues.

Niccolò