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.

CC2630: Clock only works during debug sessions and after CPU reset

Part Number: CC2630
Other Parts Discussed in Thread: CC2650, TIMAC, UNIFLASH, , CC2651R3, SYSBIOS

I am working with TIMAC (tirtos_simplelink_2_11_01_09) and trying to write a simple app that blinks some LEDs. This program works as expected when during debugging sessions but when I disconnect power and plug back in it will fire a single timer event then freeze. If I go into Uniflash and issue a CPU or System reset the LEDs blink as desires. If I issue a board reset the LEDs never turn on at all. I'm working backwards from the msa_cc2650 example app so there is a lot of bloated code here, but the relevant portions are

Void main()
{
  Task_Params taskParams;

  // set RFC mode to support IEEE802.15.4
  // Note: This must be done before the RF Core is released from reset!
  SET_RFC_MODE( RFC_MODE_IEEE );

  // enable iCache prefetching
  VIMSConfigure(VIMS_BASE, TRUE, TRUE);

  // Enable cache
  VIMSModeSet( VIMS_BASE, VIMS_MODE_ENABLED );

  /* Initialization for board related stuff such as LEDs
   * following TI-RTOS convention */
  PIN_init(BoardGpioInitTable);

  // Configure task.
  Task_Params_init(&taskParams);
  taskParams.stack = myTaskStack;
  taskParams.stackSize = MSA_TASK_STACK_SIZE;
  taskParams.priority = 1;
  Task_construct(&myTask, taskFxn, &taskParams, NULL);

  BIOS_start();     /* enable interrupts and start SYS/BIOS */
}

/**************************************************************************************************
 *                                        GLOBAL VARIABLES
 **************************************************************************************************/

/* Clock resorces */
static Clock_Params  msaLed4Params;
static Clock_Struct msaLed4;

/** LED globals */
static PIN_Config ledPinTable[] = {
  Board_LED1 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED1 initially off */
  Board_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED2 initially off */
  Board_LED3 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED2 initially off */
  Board_LED4 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED2 initially off */
  PIN_TERMINATE                                                               /* Terminate list     */
};

/* LED pin state */
static PIN_State ledPinState;

/* LED Pin Handle */
PIN_Handle ledPinHandle;


static void MSA_ClockFxn(UArg param)
{
  static bool index = false;

  PIN_setOutputValue(ledPinHandle, Board_LED1, index ? Board_LED_ON : Board_LED_OFF);
  PIN_setOutputValue(ledPinHandle, Board_LED3, index ? Board_LED_ON : Board_LED_OFF);
  PIN_setOutputValue(ledPinHandle, Board_LED2, index ? Board_LED_OFF : Board_LED_ON);
  PIN_setOutputValue(ledPinHandle, Board_LED4, index ? Board_LED_OFF : Board_LED_ON);
  index = !index;
}

static void MSA_Init(void)
{
  UInt msaLed4Period = MSA_LED4_INITIAL_PERIOD * 1000 / Clock_tickPeriod;

  ledPinHandle = PIN_open(&ledPinState, ledPinTable);

  /* Initialize clock poll parameters */
  Clock_Params_init(&msaLed4Params);
  
  /* Create a periodic poll timer */
  msaLed4Params.period = msaLed4Period;
  msaLed4Params.startFlag = TRUE; 
  msaLed4Params.arg = (UArg)MSA_LED4_EVENT;
  Clock_construct(&msaLed4, MSA_ClockFxn, msaLed4Period, &msaLed4Params);
}

void msa_task(void)
{
  /* Initialize application */
  MSA_Init();
  
  /* No return from MSA process */
  //MSA_Process();
}

  • I think this is a race condition (or undefined behavior) since I stripped out the code that prevents the task code from returning. If I add a loop preventing msa_task from returning it always works as expected.

  • Hi Daniel,

    Thanks for updating!  Please clarify the following:

    • Are you using the latest TIMAC version (1.5.2) with IAR EWARM 7.40.1 (dependency listed in the Release Notes)?
    • Can you erase all flash memory and run the default MSA example without any issues, and have the CC2630 symbol defined in the project configurations?
    • Are you using a TI EVM or a custom board?

    Could this be a hardware dependency?  I would recommend evaluating the CC2651R3 instead, which will provide much better HW (LP-CC2651P3) and SW (SIMPLELINK-LOWPOWER-F2-SDK) support.

    Regards,
    Ryan

  • Yes, I am using the latest version of TI MAC with the approved EWARM. As for the choice in hardware I am refactoring firmware for an existing already deployed product. The CC2651R3 is a likely candidate for our next hardware revision. Also as a sidenote for people serching this in the future, it isn't as simple as setting "CC2630" in the configs since TIMAC (and sysbios) often uses CC2650 as a catch-all for the CC26x0 platform since they share a huge number of identical properties.

    This is almost certainly related to ending the task prematurely. If I prevent that from happening no problematic behavior occurs. Why it initially worked at all in some conditions is still a mystery but my problem is gone.