Correct me if I'm wrong, but I don't believe the SPI softIP supports three-wire (half-duplex) mode. Has anybody implemented this? I need it for interfacing with a DS1302 real-time clock module.
SPI three-wire mode
-
- Experienced Member
- Posts: 96
- Joined: Mon Mar 22, 2010 8:55 pm
-
- Active Member
- Posts: 55
- Joined: Fri Mar 04, 2011 3:38 pm
You're correct, the xSOFTip SPI component (sc_spi) does not currently support three-wire buses.
It should be possible to use the current component as a starting point for a three-wire bus master, using a single data line rather than MISO and MOSI lines, but this will involve either avoiding the use of buffered ports, or safely changing the direction of a buffered port on the fly (depending on the performance requirements of your application).
The quad SPI module within the sc_flash repository (https://github.com/xcore/sc_flash/tree/ ... _spi_flash) makes use of a single buffered port for data, and demonstrates how to turn the port around safely.
It should be possible to use the current component as a starting point for a three-wire bus master, using a single data line rather than MISO and MOSI lines, but this will involve either avoiding the use of buffered ports, or safely changing the direction of a buffered port on the fly (depending on the performance requirements of your application).
The quad SPI module within the sc_flash repository (https://github.com/xcore/sc_flash/tree/ ... _spi_flash) makes use of a single buffered port for data, and demonstrates how to turn the port around safely.