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.

CCS/CC2640R2F: using SimpleCentral, but program run into dead cycle

Part Number: CC2640R2F

Tool/software: Code Composer Studio

I'm using SimpleCentral to develope a scanner which only listen and print the scan result, but after running the program for about two hours, the program fail to print data, i debugged for more data and found the program stopped at a while(...) sentence, as below:

static void RF_corePowerDown(void)
{
    /* Local variables to calculate active time in current window. */
    uint32_t deltaTimeInUs = 0;

    /* Disable all CPE and HW interrupts as we are about to power down the core.
       Clearing is not important as content will be lost anyway. */
    RFCCpeIntDisable(~0);
    RFCHwIntDisable(~0);

    /* Exchange the hwi service routine. */
    HwiP_setFunc(&RF_hwiCpe0Obj, RF_hwiCpe0Power, (uintptr_t)NULL);

    /* Set VCOLDO reference */
    RFCAdi3VcoLdoVoltageMode(false);

    /* Take wake up timestamp and the current timestamp */
    uint32_t rtcTimestampB = (uint32_t) AONRTCCurrent64BitValueGet();

    /* Find the radio core active delta time since the last power up. */
    deltaTimeInUs   = UDIFF(RF_rtcTimestampA, rtcTimestampB);
    deltaTimeInUs >>= RF_RTC_CONV_TO_US_SHIFT;

    /* Accumulate the delta time with the previous active time windows. Avoid overflow by using saturation. */
    RF_core.activeTimeUs = ADD(RF_core.activeTimeUs, deltaTimeInUs);

    /* Decide whether to send the CMD_SYNC_STOP_RAT command. If this is first power down (.init) or active time (activeTimeInUs)
       is longer than the time that can cause maximum allowed error between RAT and RTC clocks. Yielding will automatically fulfill
       the latter. */
    if (!(RF_core.init)    ||
         (RF_core.activeTimeUs  > (RF_errTolValInUs << RF_DEFAULT_COMB_XTAL_DRIFT_BITS_SHIFT)))
    {
        /* Stop and synchronize the RAT if it is running */
        if (RF_ratIsRunning())
        {
            /* Setup RAT_SYNC command to follow powerdown. */
            RF_ratSyncCmd.stop.commandNo                 = CMD_SYNC_STOP_RAT;
            RF_ratSyncCmd.stop.status                    = IDLE;
            RF_ratSyncCmd.stop.condition.rule            = COND_NEVER;
            RF_ratSyncCmd.stop.startTrigger.triggerType  = TRIG_NOW;
            RF_ratSyncCmd.stop.pNextOp                   = NULL;

            /* Send RAT Stop command and synchronously wait until it run. */
            RF_dbellSubmitCmdAsync((uint32_t)&RF_ratSyncCmd.stop);
            while (!(RF_ratSyncCmd.stop.status & RF_CMD_TERMINATED));
        }

        /* The RF core is now initialized and RAT is synchronized. */
        RF_core.init         = true;
        RF_core.activeTimeUs = 0;
    }

    /* Turn off Synth */
    RFCSynthPowerDown();

    /* Turn off the RF core by gating its clock. This is a quick way to have it shut off. */
    RFCClockDisable();
}





RFCC26XX_singleMode






The sentence is while (!(RF_ratSyncCmd.stop.status & RF_CMD_TERMINATED)); in RFCC26XX_singleMode.c
I want to know:

1.In what situation will the program call the function above, i cant find the upper layer who call the function

2.why the while sentence turned into dead cycle, is it hardware error or software error?

is there any direction i can solve the problem?

Looking forward to anyting helpful.

  • Can you elaborate which SDK version you use and do you modify anything to original simple_central when you test it?
  • I'm using simplelink_cc2640r2_sdk_2_20_00_49

    change codes as below:

    1.comment the menu init

    2.add print function to scan results, and comment the add scan info function

    3.add function to the init event instead of key operation, enable only scan

    4.change scan parameters and comment "stop discoverying"

  • anyone see me.....
  • It looks like the device is just sleeping. Are you freeing the results correctly? I would recommend checking the heap size when it gets into this hung state.
  • Tim C said:
    It looks like the device is just sleeping. Are you freeing the results correctly? I would recommend checking the heap size when it gets into this hung state.

    sorry, i didnt understand you. Sleeping is not a problem. but heap size overflow is fatal error, so whats the problem? 

    If the device is sleeping , how could i wake it up?

    If the heap size is the problem, how could i prove it? Add functions or it could be seen during debug? How?

    Thank you for your help.

  • Based on where the program was when you stopped, it looks like you just happened to pause the debugger when it was sleeping.

    To check the heap you can see the "Debugging-->Debugging Common Heap Problems" section of the Stack User's Guide.

    If the heap is fine, then you should check the events you are getting in SimpleCentral_scanCb to see if the scan has stopped.
  • It stopped at while (!(RF_ratSyncCmd.stop.status & RF_CMD_TERMINATED)); the 1st floor described.
    If I comment the sentence "Idle.addFunc('&Power_idleFunc');", would the device stop entering sleeping mode?
  • No, you should not touch that file. If you want to stop the device going to sleep, then do not define POWER_SAVINGS in the application preprocessor defines. I do not think this is necessary.

    Again, I would recommend tracking the events received in SimpleCentral_scanCb() to verify whether or not you are still scanning. I'm assuming that the scan has just ended.
  • Sorry i just saw your reply .
    I would add some log data to the program to make sure whether the scan is ended or not.
    Thanks for your time.