Hi everybody,
I have my custom CC2640 board and I am trying to establish an SPI communication with another chip on my board. However, my code does not execute SPI_open() statement.
Here is my main code ;
int main(void)
{
/* Call board init functions */
PIN_init(BoardGpioInitTable);
/* Open LED pins */
pinHandle = PIN_open(&pinState, pinTable);
if(!pinHandle) {
System_abort("Error initializing board pins\n");
}
SPI_init() ;
/* Set up the led task */
Task_Params workTaskParams;
Task_Params_init(&workTaskParams);
workTaskParams.stackSize = 256;
workTaskParams.priority = 2;
workTaskParams.stack = &workTaskStack;
Task_construct(&workTask, workTaskFunc, &workTaskParams, NULL);
/* Start kernel. */
BIOS_start();
return (0);
}
And here is the task and the doSPi function inside the task ;
void doSpi(void)
{
SPI_Params_init(¶ms);
params.bitRate = 1000000;
spihandle = SPI_open(CC2650_LAUNCHXL_SPI0, ¶ms);
if (!spihandle) {
System_printf("SPI did not open ");
}
spiTransaction.count = sizeof(txBuf);
spiTransaction.txBuf = txBuf;
spiTransaction.rxBuf = rxBuf;
ret = SPI_transfer(spihandle, &spiTransaction);
if (!ret) {
System_printf("Unsuccessful SPI transfer");
}
SPI_close(spihandle) ;
}
Void workTaskFunc(UArg arg0, UArg arg1)
{
while (1) {
/* Do work */
doWork();
doSpi();
/* Wait a while, because doWork should be a periodic thing, not continuous.*/
Task_sleep(1000) ;
}
}
This the what I am having after running the code in debug screen;
Thank you for your help, any suggestion is deeply appreciated.