I've tried the advice here: http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/311317.aspx and here: http://e2e.ti.com/support/microcontrollers/hercules/f/312/t/261331.aspx but I'm still having some problems.
I've successfully gotten my device to communicate using 1 MIBSPI, but the device is a little odd in it's operation and so I want to separate it and have MIBSPI1 be the master to send data to the device and use MIBSPI3 as a slave to receive data from the device. The working condition I have is with MIBSPI1 working as a master, and setting up the clock such that it matches the clock the device outputs - but not connecting it and using the SPI1 master clock. I would think that if I set up MIBSPI3 as nearly the same (other than a slave instead of a master) it should work, but I think I'm not clear on how to make the slave receive data.
Relevant code:
gioSetBit(gioPORTB,2,0); //B2 is connected to V10/MIBSPI3NCS[0] (J11 pin 76) mibspiSetData(mibspiREG3,0,tx); //Set slave data and transfer. mibspiTransfer(mibspiREG3,0); //I think I need to start slave before master mibspiSetData(mibspiREG1, 0, tx); //Set Master Data and transfer mibspiTransfer(mibspiREG1, 0); while(mibspiIsTransferComplete(mibspiREG1, 0)==0); // wait here until transfer is complete while(mibspiIsTransferComplete(mibspiREG3, 0)==0); //gets stuck here if left uncommented status = mibspiGetData(mibspiREG3, 0, rx); // get received data - blank data // status = mibspiGetData(mibspiREG1, 0, rx); // get received data - works if uncommented - but not desired SPI to receive data gioSetBit(gioPORTB,2,1); //raise CS
The main difference in HalCoGen between MIBSPI3 and MIBSPI1 is that I have 1 set up as master, default chip select of 0xFF while I have 3 set up as slave with default chip select of 0x01. I otherwise have the data formats, delays, transfer groups set up the same. I have the data out from the device tied to both SOMI on SPI1 and SIMO on SPI3, and the clock from the device tied to V9/J11 pin 78 on the HDK. I don't think should impact the code from working.
Any suggestions on what I'm not doing to be able to set up the slave to receive data? My suspicion is the CS line - but not sure what I can do with it.
Thanks