connecting 3-wire device to SPI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

connecting 3-wire device to SPI

6,955 Views
jarin
Contributor I
Hi all,
i want to connect 3-wire device (DS1302) to SPI bus, I have already connected serial EEPROM (25C640). Problem is, the DS1302 has merged MOSI and MISO pins into one pin. Is there a way to connect it to hw SPI port? I already wrote routines to connect it through bit-banged bus (on JK8, with no HW SPI port), but now i want to connect it to AB32 part with HW SPI port - and consuming additional 3 IO pins to do that (and part of flash memory to save routines) seems to be inefficient.
Thanks for zour help
Jarin
Labels (1)
0 Kudos
3 Replies

959 Views
Alban
Senior Contributor II

Hi,

Using Open Collector mode of the SPI, putting the two pins together and a pull-up on the new created bus is a solution.

You will need your master to have 0xFF in its buffer when it should receive data as it will also send data (you shift in and out !!!).

Using the 0xFF data will allow you to avoid data collision on the newly created bus.

Cheers,
Alban.

0 Kudos

959 Views
jarin
Contributor I
Alban, thank you for your time and response.
This should be possible, when only 3-wire device is hooked on SPI port. But my aim to connect both 3-wire device and "normal" SPI device to one SPI port, if possible.
 
I'll do some experiments on next weekend and report results.
 
Jarin
0 Kudos

959 Views
bigmac
Specialist III

Hello Jarin,

To avoid external signal routing issues, the simplest approach may be to use the SPI hardware for the 4-wire slave device, and your bit-banged routines for the 3-wire slave device.  The same pin furnctionality would be allocated to the software interface as the hardware interface, but using the alternate GPIO.  Of course, each slave device will need a separate SS connection, requiring a total of five pins for the two devices.

Regards,
Mac

 

0 Kudos