2019-11-27 07:48 AM
2019-11-27 08:17 AM
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.
Regards
2019-11-28 02:12 AM
2019-11-28 06:43 AM
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
2019-11-28 06:47 AM
Thank you for fast reply!
2019-12-29 06:59 AM
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.
2019-12-29 10:15 AM
Strange, SCK is an input to all slaves and should be a push pull output from the microcontroller.
Did you make sure the level shifter you use is for bidirectional lines?
Also make sure you MCU pins are not open-drain (if the pins of the micro is for I2C and SPI, there maybe issue also there).
2019-12-29 10:32 AM
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.
2019-12-29 11:45 AM
For the SCK pin of the micro to be push pull low, check voltage, high and check voltage, input and check voltage.
Could it be one of the device is not powered properly and the protection diods on the pin shows a lower voltage?
2019-12-29 12:33 PM
But data output to SDI_SDO from MCU is working properly, I think it is similar case to SCK.