Other Parts Discussed in Thread: CC1310
Tool/software: TI-RTOS
I got more understanding about TI-RTOS and SPI Libraries after posting a question in the e2e forum , Now SPI Slave is working fine in both BLOCKING and CALLBACK mode.
But now the problem is when I set the SPI transaction count to more than 1 (multiple bytes at a time) it's working fine between two launchpads, but when I replaced Master with Beaglebone Black, the launchpad doesn't decode/sample the received byte properly, there are lot errors in the received byte/characters.
I tested my BBB Master code with arduino (act as Slave) it was working fine,
I have spent more than week on this problem now, I tested with changing transfer rate (from min to max) and changing SPI Modes etc, Nothing helps.
I would like to know what I am missing in the Launchpad's Slave code?
Is it something to do with any configurations in the Launchpad code? Is this something to do with the clock speed of cc1310 is far less than the BBB
Here is my slave code with Callback function
// Callback function
static void transferCallback(SPI_Handle handle, SPI_Transaction *transaction)
{
// Start another transfer
//transaction->count = 1;
//System_printf("Status: %.*s\n",8, transaction->status); System_flush();
//for (i=0; i<8;i++){
// rxbuf[i]=0;
//}
SPI_transfer(handle, transaction);
System_printf("Callback %d Running: %c%c%c%c%c%c%c%c\n", cbcount, rxbuf[0],rxbuf[1],rxbuf[2],rxbuf[3],rxbuf[4],rxbuf[5],rxbuf[6],rxbuf[7]); System_flush();
for (i=0; i<8;i++){
rxbuf[i]=0;
}
cbcount++;
}
Void slaveTaskFxn (UArg arg0, UArg arg1)
{
UInt32 time1, time2, delta;
SPI_Handle handle;
SPI_Params params;
SPI_Transaction transaction;
//uint8_t txbuf[8]={'A','B','C','D','E','F','G','H'};
//uint8_t rxbuf[8]=0;
// Init SPI and specify non-default parameters
SPI_Params_init(¶ms);
params.bitRate = 1000000;
params.frameFormat = SPI_POL1_PHA1;
params.mode = SPI_SLAVE;
params.transferMode = SPI_MODE_CALLBACK;
params.transferCallbackFxn = transferCallback;
// Configure the transaction
transaction.count = 8;
transaction.txBuf = txbuf;
transaction.rxBuf = rxbuf;
// Open the SPI and initiate the first transfer
handle = SPI_open(Board_SPI0, ¶ms);
while(1)
{
time1 = Timestamp_get32();
SPI_transfer(handle, &transaction);
//Task_sleep(10000);
//rxbuf[8]='\0';
System_printf("Slave %d Running: %s\n", count, rxbuf); System_flush();
//Task_sleep(10000);
//System_printf("Slave Running: %s\n", rxbuf); System_flush();
while(true);
//SPI_close(handle);
time2 = Timestamp_get32();
delta = time2 - time1;
System_printf("Time taken: %d\n",delta); System_flush();
count++;
}
}