2024-01-16 10:51 PM
Hi,
I have doubt with the spi communication setup in this configuration. I'm using two sensors where one of the sensor only support 3 wire spi and another is 4 wire .I have a single spi in mcu. The hardware setup is followed by mapping four wire spi to mcu(mcu is configured in full duplex mode) and put a resistor between miso and mosi and given to three wire spi slave.
>Is it possible to make proper communication in this setup?
>If this is okay how the master mcu will differentiate betweeen them?
Solved! Go to Solution.
2024-01-17 06:02 AM
Technically, yes. You would need to reconfigure the peripheral in 3-wire mode when you wanted to use that mode and switch to 4-wire mode for the other sensors. Not something that will be supported by CubeMX.
2024-01-17 02:02 AM
Hello @Error_Code
First let me thank you for posting.
1- Yes you can make a proper communication using this setup.
Serial Peripheral Interface (SPI) allows full-duplex or half-duplex synchronous serial communication with multiple devices over 3 or 4 wires.
For example by checking the datasheet of the sensor ADXL345 ( Digital Accelerometer)
2- To differentiate between the two sensors, you can use a separate GPIO pin as an additional chip select (CS) for the 3 wire sensor.
Thx
Ghofrane
2024-01-17 04:03 AM
Thanks for your response,
Is it possible to use both three wire and 4 wire spi in same spi bus? if yes how it will work?
2024-01-17 06:02 AM
Technically, yes. You would need to reconfigure the peripheral in 3-wire mode when you wanted to use that mode and switch to 4-wire mode for the other sensors. Not something that will be supported by CubeMX.
2024-01-17 09:13 PM
If suppose this reconfiguration part is implemented , what about the hardware setup?. will it support?
The hardware setup will be like as shown above. My question is will that 10k resistor between MISO and MOSI can impact the communication between slave 1 and master mcu ?If no how the communication take place?
2024-01-18 06:05 AM
In 3 wire mode, the MOSI pin is used for both outgoing and incoming data. No need to connect them.
However, no, the 10K shouldn't affect anything, but it's also not necessary.