This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-CC2652RB: CC2652 SPI slave issue

Part Number: LP-CC2652RB

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

  • Hi Leon,

    I wonder if the line "while(spiflag);" could prevent the application task to run. Maybe you could try to use some sort of task_sleep or anything that would avoid this "busy wait".

    In addition to that, could you please use the ROV as described into our debugging guide? It would help if you could verify that no stack shotage, function blocked or anything else happen. 

    Best regards,