cancel
Showing results for 
Search instead for 
Did you mean: 

which spi mode is supported in iis3dwb sensor and why it fail to read who am i register at first attempt after reset?

karan
Associate III

I am exploring iis3dwb sensor with stm32f401 nucleo board.i go through the data sheet but not find any information which mode this sensor supported?

so i tried with these 2 setting ,

 hspi3.Init.CLKPolarity = SPI_POLARITY_LOW;

 hspi3.Init.CLKPhase = SPI_PHASE_1EDGE;

 hspi3.Init.CLKPolarity = SPI_POLARITY_HIGH;

 hspi3.Init.CLKPhase = SPI_PHASE_2EDGE;

in both  it fail to read who am i register at first attempt after reset and after that value is read correctly.why this is happen and which mode i should i use?

here i attach files i am using as whole project is of 35mb.

I found this driver file for this sensor on git hub is it ok to use this driver? as i not able to find other example code or driver for this sensor

1 ACCEPTED SOLUTION

Accepted Solutions
Eleon BORLINI
ST Employee

Hi @karan​ , as you can see from datasheet p.9, the supported is SPI mode 3 (please don't confuse it with 3-wires SPI):

0693W000003BlOTQA0.png

This means CPOL 1 and CPHA 1. You can also refer for example to the ST-WINKT1 firmware FP examples in STSW-STWINKT01_V1.3.1\Drivers\BSP\Components\iis3dwb

Please also check this other post if it can be of any help for you.

Regards

View solution in original post

1 REPLY 1
Eleon BORLINI
ST Employee

Hi @karan​ , as you can see from datasheet p.9, the supported is SPI mode 3 (please don't confuse it with 3-wires SPI):

0693W000003BlOTQA0.png

This means CPOL 1 and CPHA 1. You can also refer for example to the ST-WINKT1 firmware FP examples in STSW-STWINKT01_V1.3.1\Drivers\BSP\Components\iis3dwb

Please also check this other post if it can be of any help for you.

Regards