I'm using a SHARC 41278. The SHARC is a slave device on an SPI bus shared with other devices. I am using DPI_PIN7 as the MISO signal line on the bus, using SPI Port B.
I initially set up the SRU for the MISO signal as below:
SRU (HIGH, DPI_PBEN07_I); // activate the output buffer
SRU (SPIB_MISO_O, DPI_PB07_I);
and the SPI CTL register as:
*pSPISTLB = 0;
*pSPICTLB = PACKEN | SPIEN | WK8 | OPD | CKLPL | CPHASE | MSBF | ISSEN | SENDZ;
Now if I load the Tx register
*pTXSPIB = 0x5A;
and then have the master access the SHARC I get the data I expect (0x5A) and subsequent access return 0x00, as expected. This suggests to me that I have SPI Port B successfully configured as a slave, at least for a minimal test.
Of course, the MISO line is jammed by the SHARC and no other devices can be accessed. This is also expected with the SRU configuration above.
I then set up the SRU as follows:
SRU (LOW, DPI_PB07_I);
SRU (SPIB_MISO_O, DPI_PBEN07_I); // output buffer active/inactive driven by MISO data
As near as I can glean from the Hardware Reference Manual, this should set things up to share the MISO line.
However, the result I always get is 0xFF. The SHARC SPI never drives the MISO line -- it remains tri-stated. Of course, the other peripherals sharing this SPI bus are no longer fighting the SHARC MISO line and they now work properly.
Ideally, in SPI Slave mode, the MISO pin would be tri-stated when the SPIB_DS_I pin is HIGH and active when the SPIB_DS_I pin is LOW, but that does not appear to be an available configuration option.
I've checked all sorts of Engineering Zone discussions, and looked at all the example code I could find in the Visual DSP files, but cannot find an answer or an example.
What is the correct SRU and SPI setup so that the SHARC SPI Port B can be used as an SPI Slave on a shared SPI bus?
Thank you for reading this.