Dear Team
Good day
Our customer is using an LP-CC2652RB. I am trying to acquire data using SPIslave and advertise the data through simple_broadcaster example. Somehow as soon as I add the SPIslave task to the main function, the simple_broadcaster function stopped working. Although the SPIslave part works. I am not quite familiar with handling multiple Tasks. Any examples or hints would be helpful.
Thanks!
Here are the relevant sections of my code:
int main()
{
RegisterAssertCback(AssertHandler);
Board_initGeneral();
ICall_init();
/* Start tasks of external images - Priority 5 */
ICall_createRemoteTasks();
/* Kick off application - Priority 1 */
SimpleBroadcaster_createTask();
/* Kick off application - Priority 4 */
SPIslave_createTask();
BIOS_start(); /* enable interrupts and start SYS/BIOS */
return 0;
}
// SPI Callback
void transferCompleteFxn(SPI_Handle handle, SPI_Transaction *transaction)
{
SPI_transfer(handle, transaction);
spiflag=0;
}
static void SPIslave_taskFxn(UArg a0, UArg a1)
{
GPIO_init();
SPI_init();
SPI_Handle slaveSpi;
SPI_Params spiParams;
SPI_Transaction transaction;
uint8_t rxBuf[SPI_MSG_LENGTH]; // Receive buffer
SPI_Params_init(&spiParams);
spiParams.frameFormat = SPI_POL1_PHA1; // Rising edge
spiParams.mode = SPI_SLAVE;
spiParams.transferCallbackFxn = transferCompleteFxn;
spiParams.transferMode = SPI_MODE_CALLBACK;
slaveSpi = SPI_open(CONFIG_SPI_SLAVE, &spiParams);
transaction.count = SPI_MSG_LENGTH;
transaction.txBuf = NULL;//rxBuf;
transaction.rxBuf = rxBuf;
SPI_transfer(slaveSpi, &transaction);
while(spiflag); // Needed for SPI callback
}
Best regards,
Leon.liu