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: lp-cc2652rb code review

Part Number: LP-CC2652RB

Dear Team 

Good day 

Thank  you for your last suggestion in the forum which link below 

https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/bluetooth-forum/986178/lp-cc2652rb-cc2652-spi-slave-issue

Our customer can make both functions work by using only one task. he changed the SPI mode to blocking mode, this way the BLE part can operate.He initiate broadcasting in the SPI fxn, then keeps updating the ADV data in the main loop.
But he have another issue now. The main loop will function only for about 1 minute and then it stucked after jumping into icall_errno(). He checked the ROV, there is no stack shortage. He suspect there might be a memory issue, but somehow he cannot see heap information from ROV.

Here is the code , He is the student from UTAH , I do not know why he can not post the E2E query , thanks for your help again 

BLE_Question2_Code.txt
static void SPIslave_taskFxn(UArg a0, UArg a1)
{
    GPIO_init();
    SPI_init();
    SPI_Handle      slaveSpi;
    SPI_Params      spiParams;
    SPI_Transaction transaction;
    SPI_Params_init(&spiParams);
    spiParams.frameFormat = SPI_POL1_PHA1; // Rising edge
    spiParams.mode = SPI_SLAVE;
    spiParams.transferCallbackFxn = transferCompleteFxn;
    spiParams.transferMode = SPI_MODE_BLOCKING;
	
    slaveSpi = SPI_open(CONFIG_SPI_SLAVE, &spiParams);
    SimpleBroadcaster_init();
    // Get the ticks since startup
    uint32_t tickStart = Clock_getTicks();
    SimpleBroadcaster_Simple2();

    while(1)
    {
        memset((void *) rxBuf, 0, SPI_MSG_LENGTH);
        transaction.count = SPI_MSG_LENGTH;
        transaction.txBuf = NULL;//rxBuf;
        transaction.rxBuf = (void *) rxBuf;//    transaction.rxBuf = rxBuf;

        SPI_transfer(slaveSpi, &transaction);

        SimpleBroadcaster_Reload();
    } // Needed for SPI callback
}

static void SimpleBroadcaster_Simple2(void)
{
#ifndef BEACON_FEATURE
    advParams1.eventProps = GAP_ADV_PROP_SCANNABLE | GAP_ADV_PROP_LEGACY;
#else
    advParams1.eventProps = GAP_ADV_PROP_LEGACY;
#endif // !BEACON_FEATURE

    // Create Advertisement set
    GapAdv_create(&SimpleBroadcaster_advCallback, &advParams1,
                  &advHandleLegacy);

    // Load advertising data
    GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_ADV,
                        sizeof(advertData), advertData);

    // Load scan response data
    GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_SCAN_RSP,
                        sizeof(scanResData1), scanResData1);

    // Set event mask
    GapAdv_setEventMask(advHandleLegacy,
                        GAP_ADV_EVT_MASK_START_AFTER_ENABLE |
                        GAP_ADV_EVT_MASK_END_AFTER_DISABLE |
                        GAP_ADV_EVT_MASK_SET_TERMINATED);

    // Enable legacy advertising
    GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
}

static void SimpleBroadcaster_Reload(void)
{
    GapAdv_disable(advHandleLegacy);
    GapAdv_prepareLoadByHandle(advHandleLegacy, GAP_ADV_FREE_OPTION_DONT_FREE);

    advertData[2]=rxBuf[1];
    advertData[3]=rxBuf[2];
    advertData[4]=rxBuf[3];

    // Reload buffer to handle
    GapAdv_loadByHandle(advHandleLegacy, GAP_ADV_DATA_TYPE_ADV, sizeof(advertData), advertData);
    // Re-enable advertising
    GapAdv_enable(advHandleLegacy, GAP_ADV_ENABLE_OPTIONS_USE_MAX , 0);
}

BR,

Leon.liu