Howdy,
I have a half duplex spi device that i am setting up my spi protocol to run on my stellaris using the ssi library. I need to set it up so that the stellaris does not read during transmission of data to the device.
the protocol is like this
The code i Wrote for write is as follows. Mind the conversion from char to long for data put then back to char from long
int readfromspi_serial
(
unsigned short headerLength,
const unsigned char *headerBuffer,
unsigned long readlength,
unsigned char *readBuffer
)
{
int i=0;
unsigned char x2;
unsigned long y1;
//Enable The Slave Select pin for this device
GPIO_PORTF_DATA_R &= ~(0x04);
for(i=0; i<headerLength; i++)
{
y1 = *(headerBuffer + i);
SSIDataPut(SSI0_BASE, y1);
while(SSIBusy(SSI0_BASE))
{
}
//need to make sure to ignore reads during this time
}
for(i=0; i<readlength; i++)
{
x2 = *(readBuffer + i);
y1 = (long) x2;
//SSIDataGet(unsigned long ulBase, unsigned long *pulData)
SSIDataGet(SSI0_BASE, &y1);
while(SSIBusy(SSI0_BASE))
{
}
x2 = (char) y1;
*(readBuffer + i) = x2;
}
//Disable slave select pin
GPIO_PORTF_DATA_R |= 0x04;
return 0;
} // end readfromspi()
Thanks for any help!
