Skip to main content
Visitor II
July 24, 2020
Solved

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

  • July 24, 2020
  • 1 reply
  • 2144 views

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

    This topic has been closed for replies.
    Best answer by Eleon BORLINI

    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

    1 reply

    ST Employee
    July 30, 2020

    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