Skip to main content
Graduate
March 13, 2022
Question

LSM6DS33 not going into 3 wire spi?

  • March 13, 2022
  • 2 replies
  • 717 views

Can someone please tell me the sequence and list of registers / bits I need to touch to get this device into 3 wire SPI mode?....I am monitoring it on a logic analyzer and continue to see the data from the device on the MISO line....

I am running at 4MHz and am set to CPOL = 1, CPHA = 1 (mode 3). I can write to the WHO_AM_I and get back the correct value 0x69 on the MISO line.....BUT I need to operate this in 3 wire mode (ie data returned to CPU on MOSI).

The sequence (or where I am at now is):

WReg 0x12

WValue 0x08 (turn SPI 3 wire on, disable auto increment address)

WReg 0x13

WValue 0x04 (disable I2C enable SPI)

RReg 0x0F | 0x80

send 0x00 (produces clocks)

data on MOSI but now it reads 0x41???

BTW....I switched register 12 and 13 above and it didn't make a difference

Thanks

    This topic has been closed for replies.

    2 replies

    Visitor II
    March 13, 2022

    My checklist:

    1. Short miso amd mosi of STM32 on the board

    2. Check if the mems need to be written a bit to activate 3 wire mode. If yes, write it.

    3. To read, disable MOSI in bidirectional mode

    The challenge is to make sure mosi is disable when the sensor is sending out data. You can dynamically play with the gpio MODER register by hacking.

    On some STM32, except bidir mode, you can't control the spi clock generation all the time.

    SWenn.1Author
    Graduate
    March 13, 2022

    To your points above:

    I found the bit in the mems and am able to read back the WHO_AM_I. What do you mean disable MOSI.....I have set up the STM32L476 in CubeMX and have set it to 'Master Half Duplex'. In my setup code (before while loop) I write to the mems device firstly to turn it into 3 wire mode. Am I missing something here in disabling MOSI???