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/LAUNCHXL-CC1350: TimerIntRegister(); freeze the application

Part Number: LAUNCHXL-CC1350
Other Parts Discussed in Thread: CC1350, SYSBIOS

Tool/software: Code Composer Studio

Hi,

If i use the TimerIntRegister(); it will freeze the application and program will not run. the code is shown below:-

TimerConfigure(GPT3_BASE, TIMER_CFG_B_PERIODIC);
TimerPrescaleSet(GPT3_BASE,TIMER_B,0);
TimerLoadSet(GPT3_BASE, TIMER_B, 48000);
TimerIntRegister(GPT3_BASE, TIMER_B,GPT3_B_ISR);
TimerIntEnable(GPT3_BASE, TIMER_TIMB_TIMEOUT);

TimerIntClear(GPT3_BASE, TIMER_TIMB_TIMEOUT);
TimerEnable(GPT3_BASE, TIMER_B);


no Errors

one warning: 

Description Resource Path Location Type
#10247-D creating output section ".vtable_ram" without a SECTIONS specification rfWsnDmNode_CC1350_LAUNCHXL_TI_CC1350F128 C/C++ Problem

I think there is an issue with vector table while creating an timer ISR. But i'm new to CC studio. Also let me know how can i switch the vector table to ROM.

  • If you add the following to the SECTIONS within the Linker Command File (.cmd) for the project it will tell the linker to place the .vtable_ram section in ram, which should remove the warning and allow TimerIntRegister() to run:

        .vtable_ram     :   > SRAM

  • Chester,

    Thanks for the reply. It removed the warning. but execution is now freezes at TimerConfigure(); Also have a look at my linker file.

    /*
     *  ======== CC1350_LAUNCHXL.cmd ========
     *  CC26x0F128 PG2 linker configuration file for Code Composer Studio
     */
    
    /* Override default entry point.                                             */
    --entry_point ResetISR
    /* Allow main() to take args                                                 */
    --args 0x8
    /* Suppress warnings and errors:                                             */
    /* - 10063: Warning about entry point not being _c_int00                     */
    /* - 16011, 16012: 8-byte alignment errors. Observed when linking in object  */
    /*   files compiled using Keil (ARM compiler)                                */
    --diag_suppress=10063,16011,16012
    
    /* The starting address of the application.  Normally the interrupt vectors  */
    /* must be located at the beginning of the application.                      */
    #define FLASH_BASE              0x0
    #define FLASH_SIZE              0x20000
    #define RAM_BASE                0x20000000
    #define RAM_SIZE                0x5000
    
    /* System memory map */
    
    MEMORY
    {
        /* Application stored in and executes from internal flash */
        FLASH (RX) : origin = FLASH_BASE, length = FLASH_SIZE
        /* Application uses internal RAM for data */
        SRAM (RWX) : origin = RAM_BASE, length = RAM_SIZE
    }
    
    /* Section allocation in memory */
    
    SECTIONS
    {
        .text           :   > FLASH
        .const          :   > FLASH
        .constdata      :   > FLASH
        .rodata         :   > FLASH
        .cinit          :   > FLASH
        .pinit          :   > FLASH
        .init_array     :   > FLASH
        .emb_text       :   > FLASH
        .ccfg           :   > FLASH (HIGH)
    
    #ifdef __TI_COMPILER_VERSION__
    #if __TI_COMPILER_VERSION__ >= 15009000
        .TI.ramfunc     : {} load=FLASH, run=SRAM, table(BINIT)
    #endif
    #endif
        .data           :   > SRAM
        .bss            :   > SRAM
        .sysmem         :   > SRAM
        .stack          :   > SRAM (HIGH)
        .nonretenvar    :   > SRAM
        .vtable_ram     :   > SRAM
    }

  • MAN MCU said:
    It removed the warning. but execution is now freezes at TimerConfigure(); Also have a look at my linker file.

    I can't see any obvious problem with the linker file.

    From looking at the CC1350 documentation the clock for GPT3 is disabled at device reset, and attempting to access a peripheral for which the clock is disabled will generate a bus fault.

    Before the call to TimerConfigure(), I think the following code is required to ensure the clock for GPT3 is enabled:

            /* if it is not already on, turn on the PERIPH domain */
            if (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH) !=
                PRCM_DOMAIN_POWER_ON) {
                PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH);
                while (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH) !=
                    PRCM_DOMAIN_POWER_ON) {};
            }
    
            /* now enable the GPT clocks */
            PRCMPeripheralRunEnable(PRCM_PERIPH_TIMER3);
            PRCMPeripheralSleepEnable(PRCM_PERIPH_TIMER3);
            PRCMPeripheralDeepSleepEnable(PRCM_PERIPH_TIMER3);
            PRCMLoadSet();
            while(!PRCMLoadGet()){};

    [The above code was taken from the TI-RTOS Timer driver tirtos_cc13xx_cc26xx_2_21_00_06\products\bios_6_46_01_37\packages\ti\sysbios\family\arm\lm4\Timer.c]

  • The above solution worked well but ISR is not getting hit. The modified source is as follows.

    //System clock = 48MHz

    void TimerInit()
    {
    
            if (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH) != PRCM_DOMAIN_POWER_ON)
            {
    
                  PRCMPowerDomainOn(PRCM_DOMAIN_PERIPH);
    
                  while (PRCMPowerDomainStatus(PRCM_DOMAIN_PERIPH) != PRCM_DOMAIN_POWER_ON);
    
             }
    
    /* now enable the GPT clocks */
    
    PRCMPeripheralRunEnable(PRCM_PERIPH_TIMER3);
    
    PRCMPeripheralSleepEnable(PRCM_PERIPH_TIMER3);
    
    PRCMPeripheralDeepSleepEnable(PRCM_PERIPH_TIMER3);
    
    PRCMLoadSet();
    
    while(!PRCMLoadGet()){};
    
    TimerConfigure(GPT3_BASE, TIMER_CFG_B_PERIODIC);
    
    TimerPrescaleSet(GPT3_BASE,TIMER_B,0);
    
    TimerLoadSet(GPT3_BASE, TIMER_B, 48000);
    
    TimerIntRegister(GPT3_BASE, TIMER_B,GPT3_B_ISR);
    
    TimerIntEnable(GPT3_BASE, TIMER_TIMB_TIMEOUT);
    
    TimerIntClear(GPT3_BASE, TIMER_TIMB_TIMEOUT);
    
           Counter=0;
    
    TimerEnable(GPT3_BASE, TIMER_B);
    
    }
    
    void GPT3_B_ISR(void)
    {
    
    if(TimerIntStatus(GPT3_BASE,true)==TIMER_TIMB_TIMEOUT)
    {
    
           TimerIntClear(GPT3_BASE, TIMER_TIMB_TIMEOUT);
    
           Counter++;
    
    }
    
    }

    Let me know what might be wrong.