2023-12-26 12:13 AM
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
2023-12-26 02:04 AM - edited 2023-12-26 02:08 AM
SPI modes:
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:
Also the interface can be in different "mode" : SPI , I2C , I3C -> depends on pin settings
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.
2023-12-26 05:13 AM
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.
But there is no timing diagram available for SPI Mode 0.
Regards
Sarthak
2023-12-26 05:31 AM
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 ...)
If there is a "spi-mode 0" with different timing or whatever, there is nothing about in this ds.
2023-12-28 01:03 AM
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
2023-12-28 01:23 AM
Just try the spi communication - then you know 100% sure.
+ CPOL =1 and CPHA =1 --- i think, just try it!
+ see:
https://hackaday.com/2016/07/01/what-could-go-wrong-spi/
2023-12-28 01:41 AM
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
2023-12-28 01:49 AM
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.
2023-12-28 02:23 AM
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.
2023-12-28 04:11 AM - edited 2023-12-28 04:25 AM
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.