Skip to main content
Visitor II
May 26, 2021
Solved

problem with Lis2dw12 data ready interrupt.

  • May 26, 2021
  • 2 replies
  • 1480 views

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.

    This topic has been closed for replies.
    Best answer by niccolò

    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ò

    2 replies

    niccolòAnswer
    ST Employee
    May 27, 2021

    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.2Author
    Visitor II
    May 28, 2021

    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!

    ST Employee
    May 28, 2021

    Hi @MRive.2​ ,

    you are welcome =)

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

    Niccolò