Other Parts Discussed in Thread: CC2640,
Trying to use SPI with sensor controller. I am working on a project which had a Nordic chip interfaced to a Blackfin DSP. The interface was implemented using SPI, a chip select and a DataRdy.
- The Nordic chip[ would assert DataRdy to interrupt the DSP.
- The DSP would assert the chip select.
- Each Toggle of the DataRdy line after that would tell the DSP to grap data off the SPI
- This toggling and data exchange would occur for 10 bytes.
- After 10 bytes the DataRdy toggling would stop and chip select would be taken away.
We have since replaced the Nordic with the TI cc2640r2. I am trying to adjust the use of the SPI to the DSP interface.
I have working C code on the cc2640 processor which has implemented a successful transfer of data over the SPI using the
scheme outlined above. Currently it does cc2640 --> DSP but the Nordic implementation support for bytes from cc2640<-- at the same transfer. I did not implement this in the cc2640 processor.
***QUESTION*** the cc2640 data put into the spi fifo a byte at a time (because of the use of DataRdy) seems to support only 8 bytes, after that bytes get repeated but do not send real byte 9 and 10. I am assuming that I would have to take chip select away and then assert it again in order to get more then 8 bytes.
So I moved over to the sensor processor. I was able to get the same 8 bytes transfer implemented including chip select and DataRdy just like the cc2640 C code. I modified the architecture of the code to use alerts etc.. and the data from cc2640 to the DSP works and the data at the DSP is correctly received.
But then I tried to move to using the TxRX function to try to get bytes in both directions but I only get zero when reading the MOSI data in the sensor controller
I have a logic analyzer on clock, chip select, Data Rdy and MOSI and MISO. I can see all 10 bytes on MISO (cc2640-->DSP) and also see 10 bytes of data on MOSI (cc2640<--DSP). This is on a logic analyzer with an interpreter running and specifying which pins are which (MOSI/MISO). The MISO data is interpreted correctly and seems good and the MISO data is interpreted correctly and seems good. By interpreted I means sampled with the clock. The MISO data arrives and is accpeted by the DSP and the data being applied to MOSI fromthe DSP seems correct byte being read at the sensor controller is always zero.
This is the code that transfer 10 bytes
U16 xmitByte = 0;
U16 rcvByte = 0;
for (U16 n=0; n < BufferDataSize; n++) {
gpioToggleOutput(AUXIO_O_DREADY);
xmitByte = output.BufferData[n];
spiTxRx8bit(SPI_POL1_PHA1, xmitByte; rcvByte);
output.CommandBuffer[n] = rcvByte;
tdly = 30; // Tdly is about 10.3us
while (tdly != 0) {
tdly = tdly - 1;
}
gpioGetInputValue(AUXIO_I_SCSN; cs); // Sample cs
ifnot (cs == 0) {
abortspi = 1;
}
}
If I replace the spiTxRx8bit with spiTx8bit it works in one direction.
So any clue or guidance to what I need to do different or try in order to resolve this. I guess I could go back to the C code in the cc2640 that worked and modify it to do both directions but I was hoping I could move forward and not have to back track to the C code implementation. The sensor controller implementation seems to be working great and interfaces well with the BLE architecture I have implemented.
Also I have been successful using the sensor controller and BLE platform in order to have a transmitter acquire data from the AtoD and transmitt the data. This is the receive side. So I am a little familiar with the sensor controller and getting the RTOS to handle using it. I have established flags and input and output data buffers accessible from the BLE processor.
Thanks,
Paul Hembrook