We are affraid when one device has CS signal down, other devices will be set to I2C there can be conflict on the SPI BUS. Is it possible connect more devices as eclosed schematic?
Hi @PUnze.1720 , you should not worry about this because the SPI and I2C communication protocol are different and the SPI cannot induce an I2C communication on the device. So, ok to share the SPI lines among the sensors, except from the CSs.
Btw, a good practice is to write the I2C_ DISABLE bit on CTRL2_A (21h) for all the devices (p.52 of the datasheet), during the initialization phase of your application, so that you prevent any I2C/SPI interference by default.
Do you have any recommendation for connection of 4-wire SPI master to 3-wire SPI slaves? Is it possible use enlosed schematic? If so, what value of R1?
Yes, your schematic seems ok. A 1kOhm resistor should be ok for the master to control the slave via the resistor when the slave itself isn't driving the pin. Btw in this configuration (4-wire master, 3-wire slave) you have to implement the SPI communication in bit banging. Regards
My testing board with 3-wire SPI devices is ready. There are more magnetometers on my board. More complicated connection of LSM9DS1 on 3.3V connected with ATXMEGA on 1.8V via level shifter works properly. But clock to LSM303AH are pulled down to level 0.9V whereas SDI_SDO are good 1.8V level. And, of course, LSM303AH does not answer. What can be reason of it? Connection in principle and software are very similar I suppose.
Please forget to level shifter - it was only example for LSM9DS1 - I could verify properly working communication of 3-wire SPI. It is on second PCI. Now I am working ( MCU and LSM303AH ) on 1,8V of course. I tried to play with settings of output pin topology of MCU connected to clock, but without succes. After problem with level pulled down I let only one LSM303AH connected to MCU (clock and data) and result is the same - clock of 0,9V level. Strange. I would like order LSM303AH kit to try to find problem - it will be easier to play with MCU and not destroy complicated PCB.
Regarding of PCB design it was very complicated to find solution. Now, after replacing of one bad device on the bus everything works well as should and level on SCK is 1,8V. Thank you for your support.