cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DSO - SPI Modes Issue

Smalik
Associate II

Hello,

I ordered this IC for one of my products and am confused about the SPI modes. In the datasheet, it is mentioned that it will support SPI mode 0 and mode 3, but I have not found any timing diagram of SPI mode 0 in the datasheet. Can you provide me more details about this IC How can I change the SPI modes and on which mode this IC works fine, and the timing diagram of SPI mode 0?

 

Thanks and Regards

Sarthak Malik

 

9 REPLIES 9
AScha.3
Chief III

SPI modes:

AScha3_0-1703583145921.png

I think, its not explained in a clear way: mode0 is 4-wire , other mode is 3-wire SPI , depends on SIM bit in ctrl3_c register.

"mode" is also used for the operating mode , so this is confusing somewhat, see:

AScha3_1-1703584409725.png

Also the interface can be in different "mode" : SPI , I2C , I3C -> depends on pin settings

AScha3_2-1703584667692.png

AScha3_3-1703585289861.png

 

 

So there is no "better" timing on SPI, just 3 or 4 wire mode can be selected, default is 4 wire SPI.

I would try this 4 wire SPI first.

 

If you feel a post has answered your question, please click "Accept as Solution".

Hello,

 

Thanks for your reply. I think these are not SPI modes. These are connection modes.  I am asking about the SPI modes. In the datasheet, it is mentioned that it supports both SPI modes. Mode 0 and mode 3 as you can see in the attached screenshot.

Smalik_0-1703596292339.png

But there is no timing diagram available for SPI Mode 0.

Smalik_1-1703596357632.png

Regards

Sarthak

Yes, but this i tried to explain: SPI has 4 or 3 wire mode, thats it. Other is the operating mode ...3 or whatever;

(as i understand this ...)

AScha3_0-1703597174960.png

If there is a "spi-mode 0" with different timing or whatever, there is nothing about in this ds.

If you feel a post has answered your question, please click "Accept as Solution".
Smalik
Associate II

Hello,

 

Thanks for the reply. So, is it working fine on SPI Mode 0, that is, CPOL =0 and CPHA =0? and if it is working fine, can you provide me the timing diagram of the SPI Mode 0?

 

Regards

Sarthak Malik

Just try the spi communication - then you know 100% sure.

AScha3_0-1703754888097.png

CPOL =1 and CPHA =1  --- i think,  just try it!

+ see:

https://hackaday.com/2016/07/01/what-could-go-wrong-spi/

 

If you feel a post has answered your question, please click "Accept as Solution".
Smalik
Associate II

I know it will work fine on CPOL 1 and CPHA 1. but my concern is whether it will work on CPOL 0 and CPHA 0 or not.

 

Regards

Sarthak

So you just wanna play around with some settings - just for fun ?

CPOL 0 and CPHA 0 also latch data on rising clock - maybe it works - just try it.

If you feel a post has answered your question, please click "Accept as Solution".
Smalik
Associate II

No, I do not wanna play with settings. Actually, the problem is I have another IC that is also configured on CPOL 0 and CPHA 0. So, on the same SPI line, I want to connect this IC. So that's why I want to confirm whether it will work on CPOL 0 and CPHA 0 or not.

Ok, so you need 2x CS to select one of the chips , setting in software a port/pin. (no hardware css)

Just set spi register (SPIxCFG2 - i think) with CPOL 0 and CPHA 0 , then do spi transfer, when using chip A , or 

set CPOL 1 and CPHA 1 then CS low for the LSMxx , then do spi transfer on this chip.

Easy, fast and will work with both chips with their correct timing/phase.

If you feel a post has answered your question, please click "Accept as Solution".