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/CC1310: RTOS + AON_RTC_CH1

Part Number: CC1310

Tool/software: Code Composer Studio

Hello.

I tried to use RTC channel 1. Everything seems to be fine until the CC1310 is in debug mode. As soon as I press to stop debugging, the interruption from RTC channel 1 stops working.
What could be the reason ? what am I doing wrong ?

An interrupt handling function has been added to the file tirtos/release.cfg:

var Timer = xdc.module('ti.sysbios.family.arm.cc26xx.Timer');
Timer.funcHookCH1 = "&RTC_CH1_IRQ";

Below is part of my source code.

/* Stack size in bytes */
#define THREADSTACKSIZE     1024
#define RTC_TIME            0x40

Event_Struct main_event;
const char* const MAIN_EVENT_NAME = "RTCEvent";

/* Events used in the application */
typedef enum
{
    Event_RTC = Event_Id_00,
}MainEvent;

/*
 *  ======== RTC CH1 ========
 */
void RTC_CH1_IRQ(void)
{
    uint32_t now;
    uint32_t next;

    GPIO_toggle(Board_GPIO_LED0);

    now = AONRTCCurrentCompareValueGet();
    next = now + RTC_TIME;

    AONRTCCompareValueSet(AON_RTC_CH1, next);

    Event_post(Event_handle(&main_event), Event_RTC); // wakeup mainThread
}

/*
 *  ======== mainThread ========
 */
void *mainThread(void *arg0)
{
    GPIO_init();
    GPIO_setConfig(Board_GPIO_LED0, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
    GPIO_setConfig(Board_GPIO_LED1, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);

    Event_Params eventParams;
    Event_Params_init(&eventParams);
    eventParams.instance->name = (xdc_String)(MAIN_EVENT_NAME);
    Event_construct(&main_event, &eventParams);

    AONRTCEventClear(AON_RTC_CH1);
    AONRTCCompareValueSet(AON_RTC_CH1, RTC_TIME );
    AONRTCChannelEnable(AON_RTC_CH1);
    AONRTCCombinedEventConfig(AON_RTC_CH0 | AON_RTC_CH1);

    while (1)
    {
        Event_pend(Event_handle(&main_event), Event_Id_NONE, (Event_RTC), BIOS_WAIT_FOREVER);
        GPIO_toggle(Board_GPIO_LED1);
    }
}

//--------------------------------------------------------------------------------------------------------------
/*
 *  ======== main ========
 */
int main(void)
{
    pthread_t           thread;
    pthread_attr_t      attrs;
    struct sched_param  priParam;

    /* Call driver init functions */
    Board_init();

    /* Initialize the attributes structure with default values */
    pthread_attr_init(&attrs);

    /* Set priority, detach state, and stack size attributes */
    pthread_attr_setschedparam(&attrs, &priParam);
    pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);

    // Main Task
    pthread_attr_setstacksize(&attrs, THREADSTACKSIZE);
    priParam.sched_priority = sched_get_priority_max(NULL);
    pthread_create(&thread, &attrs, mainThread, NULL);

    BIOS_start();

    return (0);
}