cancel
Showing results for 
Search instead for 
Did you mean: 

iis3dwb data seems abnormal when in static

sming.1
Associate II

Below is the data for 3 axis data during static status. I feel it abnormal. It looks huge noise.

is it normal? can you give some data if it is in static state.

Acceleration [mg]:-161.28 -36.36 -923.78

Acceleration [mg]:-126.88 -7.08 -941.84

Acceleration [mg]:-159.09 -25.86 -947.21

Acceleration [mg]:-147.13 -24.40 -943.79

Acceleration [mg]:-140.79 -15.62 -925.74

Acceleration [mg]:-157.87 -40.02 -936.23

Acceleration [mg]:-143.47 -20.50 -941.84

Acceleration [mg]:-142.01 -42.94 -940.62

Acceleration [mg]:-144.69 -28.30 -957.21

Acceleration [mg]:-154.21 -31.48 -916.46

Acceleration [mg]:-122.98 -25.38 -953.31

Acceleration [mg]:-150.55 -15.13 -949.40

Acceleration [mg]:-148.84 -16.84 -936.72

Acceleration [mg]:-160.55 -38.31 -917.93

Acceleration [mg]:-139.32 -23.42 -939.40

Acceleration [mg]:-150.06 -37.33 -921.83

Acceleration [mg]:-135.42 -13.42 -936.72

Acceleration [mg]:-162.75 -23.42 -940.13

Acceleration [mg]:-152.99 -1.46 -953.06

Acceleration [mg]:-169.82 -39.53 -931.35

Acceleration [mg]:-150.55 -8.78 -934.52

Acceleration [mg]:-161.77 -50.75 -918.66

Acceleration [mg]:-140.30 -9.76 -962.58

Acceleration [mg]:-165.92 -30.99 -942.82

Acceleration [mg]:-142.01 -7.08 -949.89

Acceleration [mg]:-176.17 -33.43 -946.72

Acceleration [mg]:-140.79 -16.10 -952.58

Below is the init sequence:

 dev_ctx.write_reg = platform_write;

 dev_ctx.read_reg = platform_read;

 dev_ctx.handle = &SENSOR_BUS;

 /* Check device ID */

 iis3dwb_device_id_get(&dev_ctx, &whoamI);

 printf("whoamI is %x\r\n",whoamI);

 /* Restore default configuration */

 iis3dwb_reset_set(&dev_ctx, PROPERTY_ENABLE);

 do {

  iis3dwb_reset_get(&dev_ctx, &rst);

 } while (rst);

 /* Enable Block Data Update */

 iis3dwb_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);

 /* Set Output Data Rate */

 iis3dwb_xl_data_rate_set(&dev_ctx, IIS3DWB_XL_ODR_26k7Hz);

 /* Set full scale */

 iis3dwb_xl_full_scale_set(&dev_ctx, IIS3DWB_8g);

iis3dwb_pin_int1_route_t int1_route;

int1_route.drdy_xl = 1;

iis3dwb_pin_int1_route_set(&dev_ctx, &int1_route);

 /* Configure filtering chain(No aux interface)

  * Accelerometer - LPF1 + LPF2 path

  */

 // iis3dwb_xl_hp_path_on_out_set(&dev_ctx, IIS3DWB_HP_ODR_DIV_800);

 // iis3dwb_xl_filter_lp2_set(&dev_ctx, PROPERTY_ENABLE);

iis3dwb_data_ready_mode_set(&dev_ctx,PROPERTY_ENABLE);

1 ACCEPTED SOLUTION

Accepted Solutions
sming.1
Associate II

Thanks a lot, Eleon.

It is resolved by below changes

 iis3dwb_xl_hp_path_on_out_set(&dev_ctx, IIS3DWB_HP_ODR_DIV_800);

 iis3dwb_xl_filter_lp2_set(&dev_ctx, PROPERTY_ENABLE);

-->

iis3dwb_xl_hp_path_on_out_set(&dev_ctx, IIS3DWB_XL_ODR_26k7Hz);

iis3dwb_xl_filter_lp2_set(&dev_ctx, PROPERTY_ENABLE);

so I believe it is due to a wrong setting on filter related.

The data looks normal now with the interrupt enabled.  There is some noise, but it is at least normal. The acc rms in static drops to 0.010 m/s2 now. 

View solution in original post

6 REPLIES 6
Eleon BORLINI
ST Employee

Hi @sming.1​ ,

Are you facing the same issue also in the simple data read case, I mean without the INT1 pin configured? And on more than one device?

I cannot see something strange in the configuration, it is similar to the one available on Github, at this link: iis3dwb_read_data_polling.c.

-Eleon

sming.1
Associate II

Thanks, Eleon.

it looks much better when using polling in 10ms internal(see bottom log). so it looks like an interrupt related...

in interrupt handling, it is pretty straight forward as calling below function to read out the data.

iis3dwb_acceleration_raw_get(&dev_ctx, data_raw_acceleration);

i checked the odr with a gpio toggling in interrupt handler, it is 26.7 k about.

below is the spi init sequence.

static void MX_SPI1_Init(void)

{

 /* USER CODE BEGIN SPI1_Init 0 */

 /* USER CODE END SPI1_Init 0 */

 /* USER CODE BEGIN SPI1_Init 1 */

 /* USER CODE END SPI1_Init 1 */

 /* SPI1 parameter configuration*/

 hspi1.Instance = SPI1;

 hspi1.Init.Mode = SPI_MODE_MASTER;

 hspi1.Init.Direction = SPI_DIRECTION_2LINES;

 hspi1.Init.DataSize = SPI_DATASIZE_8BIT;

 hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;

 hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;

 hspi1.Init.NSS = SPI_NSS_SOFT;

 hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_8;

 hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;

 hspi1.Init.TIMode = SPI_TIMODE_DISABLE;

 hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;

 hspi1.Init.CRCPolynomial = 10;

 hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;

 hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;

 if (HAL_SPI_Init(&hspi1) != HAL_OK)

 {

  Error_Handler();

 }

 /* USER CODE BEGIN SPI1_Init 2 */

 /* USER CODE END SPI1_Init 2 */

}

Temperature [degC]: 25.05

Acceleration [mg]:45.99 75.58 -905.00

Temperature [degC]: 24.99

Acceleration [mg]:42.58 76.37 -904.87

Temperature [degC]: 24.98

Acceleration [mg]:43.07 75.40 -905.97

Temperature [degC]: 24.98

Acceleration [mg]:44.71 75.64 -910.36

Temperature [degC]: 25.01

Acceleration [mg]:43.80 74.30 -909.02

Temperature [degC]: 25.00

Acceleration [mg]:42.09 72.22 -899.38

Temperature [degC]: 25.04

Acceleration [mg]:42.94 75.88 -908.41

Temperature [degC]: 25.00

Acceleration [mg]:43.19 72.47 -913.17

Temperature [degC]: 25.00

Acceleration [mg]:45.51 74.48 -901.64

Temperature [degC]: 24.99

Acceleration [mg]:44.71 76.98 -915.85

Temperature [degC]: 25.02

Acceleration [mg]:44.53 75.27 -897.19

Temperature [degC]: 24.95

Acceleration [mg]:44.90 75.64 -908.17

Temperature [degC]: 25.00

Acceleration [mg]:44.29 75.76 -908.05

Temperature [degC]: 24.99

Acceleration [mg]:43.07 73.69 -900.91

Temperature [degC]: 24.94

Acceleration [mg]:44.04 74.97 -899.38

Temperature [degC]: 25.00

Acceleration [mg]:43.80 74.18 -905.00

Temperature [degC]: 24.98

Acceleration [mg]:46.42 76.74 -911.83

Temperature [degC]: 25.02

Acceleration [mg]:44.29 72.83 -908.78

Temperature [degC]: 25.02

Acceleration [mg]:45.99 72.77 -910.97

Temperature [degC]: 25.06

Acceleration [mg]:44.04 74.05 -908.17

Temperature [degC]: 25.02

Acceleration [mg]:45.87 72.71 -905.97

Temperature [degC]: 25.02

Acceleration [mg]:43.55 72.35 -901.82

Temperature [degC]: 24.98

Acceleration [mg]:39.28 74.66 -909.51

Temperature [degC]: 25.01

Acceleration [mg]:41.48 73.14 -904.87

Temperature [degC]: 25.02

Acceleration [mg]:42.70 78.45 -905.48

Temperature [degC]: 25.02

Acceleration [mg]:46.42 75.52 -901.70

Temperature [degC]: 25.01

Acceleration [mg]:44.29 75.03 -910.49

Temperature [degC]: 25.01

Acceleration [mg]:43.55 74.11 -909.27

Temperature [degC]: 24.98

Acceleration [mg]:42.70 73.81 -903.04

Temperature [degC]: 25.04

Acceleration [mg]:41.48 72.71 -902.56

Temperature [degC]: 25.01

Acceleration [mg]:43.68 71.98 -904.08

Temperature [degC]: 24.97

Acceleration [mg]:48.68 74.66 -906.28

Temperature [degC]: 25.02

Acceleration [mg]:43.68 77.84 -911.46

Temperature [degC]: 25.00

Acceleration [mg]:44.04 73.93 -907.92

Temperature [degC]: 24.98

Acceleration [mg]:43.62 74.54 -907.31

Temperature [degC]: 25.00

Acceleration [mg]:45.02 72.90 -908.17

Temperature [degC]: 25.02

Acceleration [mg]:43.92 77.90 -904.51

Temperature [degC]: 25.02

Acceleration [mg]:41.85 75.52 -906.09

Temperature [degC]: 25.01

Acceleration [mg]:42.70 75.76 -904.87

Temperature [degC]: 25.00

Acceleration [mg]:41.85 76.74 -906.70

Temperature [degC]: 25.02

Acceleration [mg]:42.15 76.01 -909.63

Temperature [degC]: 25.01

Acceleration [mg]:40.99 76.43 -908.05

sming.1
Associate II

when i just read whoami in interrupt handler, it always returns 0x7b, which is correct. so looks spi is no problem. seems the real data is not okay.

Hi @sming.1​ ,

you may try to disable the BDU commenting the below line of your code, and see if something changes.

 /* Enable Block Data Update */

 iis3dwb_block_data_update_set(&dev_ctx, PROPERTY_ENABLE);

-Eleon

Eleon BORLINI
ST Employee

Hi @sming.1​ ,

let me please add a couple of suggestions, in case they can be of some utility for you:

  • Data in IIS3DWB are represented as 2’s complement numbers. Please check the AN5444 application note, chapter 4.5;

  • If you want to determinate the DC acceleration component (earth gravity), you can enable internal High Pass (HPF) filter in IIS3DWB, as explained in the datasheet, figure 14 (for the freq response with HPF enabled and its bandwidth settings) and also chapter 9.17 how to set it - CTRL8_XL (17h).

Btw, is the data polling reading procedure a possible workaround for you?

-Eleon

sming.1
Associate II

Thanks a lot, Eleon.

It is resolved by below changes

 iis3dwb_xl_hp_path_on_out_set(&dev_ctx, IIS3DWB_HP_ODR_DIV_800);

 iis3dwb_xl_filter_lp2_set(&dev_ctx, PROPERTY_ENABLE);

-->

iis3dwb_xl_hp_path_on_out_set(&dev_ctx, IIS3DWB_XL_ODR_26k7Hz);

iis3dwb_xl_filter_lp2_set(&dev_ctx, PROPERTY_ENABLE);

so I believe it is due to a wrong setting on filter related.

The data looks normal now with the interrupt enabled.  There is some noise, but it is at least normal. The acc rms in static drops to 0.010 m/s2 now.