Thank you very much for your response. It sounds like your project is very similar to mine.
I am still not able to get the NE64 to send data in slave mode. I have seen data come out of it in master mode. I am about to give up and rewire my circuit to allow the NE64 to be the master, and see if that gets the job done.
I also sent a request directly to Freescale, and got a response from them. Below are their questions and my responses.
FS - Are you sure that your CPOL needs to be cleared?
ME - I can configure the PIC either way. I have it configured with the
idle state of SCK low to make the power control in my design
easier.
Should the CPOL setting affect the non-transmission of data in slave
mode?
FS- Double check with your PIC part and the timing diagrams of the SPI.
ME - Since the NE64 receives data correctly from the PIC, I am pretty
sure the clock settings and hardware hookup are correct. As
described below, I have tried several different configurations.
Always the same result PIC->NE64 fine, NE64->PIC not.
FS - It does notsound like you are using the SPTEF flag correctly. This flag will normally be set until you read from the status register and follow itwith a write to the data register.
ME - I see a problem with SPTEF. I poll for it to be high, then write data to the SPIDR. After a few NOPs, I can read the SPISR and SPTEF
is still a one. Here is a code snippet:
while (!( SPISR & SPTEF )) {
; // wait until tx buffer empty
}
SPIDR = SPI_STX; // prepare to send the first byte
NOP();
NOP();
temp = SPISR;
NOP();
If I set a breakpoint on the last NOP, I can see the temp is equal
to 0x20, meaning that SPTEF is still set.
I have even added code to loop on SPTEF not going false, and
continually loaded the SPIDR until it does go false. I think this
takes only two writes to the SPIDR to make SPTEF go false.
Even then, the data I put into the SPIDR does not come out on
the MISO pin. The data I see coming out of the MISO pin is an
echo of the data sent into the chip on the MOSI pin, from the PIC.
I thought the problem could be the CPHA mode, so I configured
the hardware with CPHA = 0, and wired up a pin from the PIC to
drive SPI_SS/ as required (low during transfer, high between bytes.)
The NE64 can receive data correctly, but still only sends an echo
of the data it received.
I then reset the hardware back to CPHA=1 mode, and still use the
SPI_SS/ pin as a gate during the byte transfer. Still nothing but an
echo out of the NE64.
To test the SPI hardware in the particular NE64 chip on the eval board
I am using, I put it into Master mode. With my PIC halted and the
signals from it to the NE64 tri-stated so the NE64 could change
direction and drive SCK and MOSI. I can see the data I am trying
to transmit come out on the pins as I would expect. This leads me
to believe the chip is functional.
FS - Another easy question, are you sure you are checking the MISO signal? This is the one that has the slave out data.
ME - Yes, I think this is wired correctly, as on an o-scope, I can see the data it is sending come out on the MISO pin. I see the data coming
from the PIC on the MOSI pin in one byte get echoed back out of the
NE64 on the MISO pin in the next byte.
FS - The baud generator does not make any difference in slave
mode, but setting it will have no adverse effect.
ME - I have tried not setting the SPIBR and setting it, with no effect.
FS - All I can recommendis to see if any data is actually coming from the MISO signal. Let me know more if you still need help. I just am not sure what else it could be.
ME - As described above, I have seen data on the NE64 pins as I would
expect. Just not the correct data, in slave mode.