Hi Guys,
I'm using the ti-rtos spi driver to communicate to an fram chip. Unfortunately I can't seem to find how to control the SPI_CS on my cc3200 lp.
I need it to go to LOW at the beginning of the transmission and go HIGH after some frames and not get back up to HIGH in between frames. I would also like to keep the data size to 8 Bit.
I've got a workaround by using an GPIO as CS, but it doesn't seem to switch as fast as an CS pin.
Code:
...
...
...
while (1) {
/*Read Manufacturer ID, Continuation code, Product ID (1st Byte), Product ID (2nd Byte) */
MAP_GPIOPinWrite(GPIOA2_BASE,GPIO_PIN_6,0); //Set GPIO Pin 15 to 0
SPI_set_Data(read_Device_ID_Array);
SPITxRx = SPI_transmit_Data(&frameCount_ID);
MAP_GPIOPinWrite(GPIOA2_BASE,GPIO_PIN_6,GPIO_PIN_6); //Set GPIO Pin 15 to 1
Task_sleep (1000);
}
...
...
...
/*
* ======== SPI_init ========
*/
void SPI_Helper_init(uint8_t indexSPI)
{
Error_Block eb;
SPI_Params spiParams;
Error_init(&eb);
SPI_Params_init(&spiParams);
spiParams.bitRate = 8000000;
spiParams.dataSize = 8;
spiParams.mode = SPI_MASTER;
spiParams.frameFormat = SPI_POL0_PHA0;
spiHandle = SPI_open(indexSPI, &spiParams);
}
/*
* ======== SPI_set_Data ========
*/
void SPI_set_Data(uint8_t *txData)
{
SPISend[0] = txData[0];
SPISend[1] = txData[1];
SPISend[2] = txData[2];
SPISend[3] = txData[3];
SPISend[4] = txData[4];
}
/*
* ======== SPI_transmit_Data ========
*/
uint8_t *SPI_transmit_Data(uint8_t *frameCount)
{
SPI_Transaction spiTransaction;
spiTransaction.count = *frameCount;
spiTransaction.txBuf = SPISend;
spiTransaction.rxBuf = SPIReceive;
SPI_transfer(spiHandle, &spiTransaction);
return SPIReceive;
}
Logic:
Channel 4 is the GPIO which I use as CS.
I'd like to keep CE / SPI-Enable LOW during the transmission.
Any suggestions?
Thanks
