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.

c6670 Timer

I want to make a staircase signal where its amplitude varies with time using c6670 Board .

But i don't know how to control the time  maybe it's a kind of timer but i don't know which functions i should use and how to do that.

also is there a ready made example for that?

thanks in advace

  • Hi, 

    Welcome to the TI E2E forum. I hope you will find many good answers here and in the TI.com documents and in the TI Wiki Pages (for processor issues). Be sure to search those for helpful information and to browse for the questions others may have asked on similar topics (e2e.ti.com).

    Please refer below post for timer examples.

    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/347541/1216931.aspx#1216931

    MCSDK 2.x: http://software-dl.ti.com/sdoemb/sdoemb_public_sw/bios_mcsdk/latest/index_FDS.html

    UG: http://processors.wiki.ti.com/index.php/BIOS_MCSDK_2.0_User_Guide

    Thanks.

  • thanks for your answer .

    I was working to generate a chirp signal with time so i want to construct a staircase signal and i  need timers  in this.

    and this is the code which i made , I have edited the timer example of the C6678 to use it for my C6670 board .

    this is an  error free code but , i don't have any experience so i can't know if it will make the required task or not.

    any help n checking this code and telling me how to know if the time is working or not from the simulator.


    #include <stdio.h>
    #include <string.h>
    #include <ti/csl/csl_tmr.h>
    #include <ti/csl/csl_tmrAux.h>
    //#include <ti/csl/src/intc/csl_intc.h>
    //#include <ti/csl/src/intc/csl_intcAux.h>

    #define MAX_DELAY 0xFF


    /* Global Handle which keeps track of the WATCH-DOG Timer. */
    CSL_TmrHandle wdTmr;

    /* INTC Objects */
    //CSL_IntcObj tmrIntcObj;
    //CSL_IntcContext context;
    //CSL_IntcEventHandlerRecord EventHandler[30];

    /* Global Variable for the INTC Module; useful for debugging. */
    //CSL_IntcRegsOvly gIntcRegisters = (CSL_IntcRegsOvly)CSL_CGEM0_5_REG_BASE_ADDRESS_REGS;

    /* Counter for Timer ISR */
    volatile Int32 timerISRCounter = 0;

    //static void TimerInterruptHandler (void *arg)
    //{
    /* Increment the number of interrupts detected. */
    // timerISRCounter++;

    /* Clear the event ID. */
    //CSL_intcEventClear((CSL_IntcEventId)arg);
    //}


    static Int32 test_gp_timer (Uint8 IntcInstance)
    {
    // CSL_IntcHandle tmrIntcHandle;
    CSL_TmrHandle hTmr;
    CSL_TmrObj TmrObj;
    //CSL_IntcEventHandlerRecord EventRecord;
    //CSL_IntcParam vectId;
    CSL_Status status;
    CSL_TmrHwSetup hwSetup = CSL_TMR_HWSETUP_DEFAULTS;
    CSL_TmrEnamode TimeCountMode = CSL_TMR_ENAMODE_ENABLE;
    Uint32 delayCount;

    /* Clear local data structures */
    memset(&TmrObj, 0, sizeof(CSL_TmrObj));
    printf("Debug: Testing 64bit Timer in Single Shot Mode...\n");

    /**************************************************************
    ********************** INTC related code *********************
    **************************************************************/

    /* Open INTC */
    //vectId = CSL_INTC_VECTID_12;
    //tmrIntcHandle = CSL_intcOpen(&tmrIntcObj, CSL_GEM_TINTLN, &vectId, NULL);

    /* Bind ISR to Interrupt */
    //EventRecord.handler = (CSL_IntcEventHandler)&TimerInterruptHandler;
    //EventRecord.arg = (void *)CSL_GEM_TINTLN;
    //CSL_intcPlugEventHandler(tmrIntcHandle, &EventRecord);

    /* Event Enable */
    //CSL_intcHwControl(tmrIntcHandle, CSL_INTC_CMD_EVTENABLE, NULL);


    /**************************************************************
    ********************** Timer related code ********************
    **************************************************************/

    /* Open the timer. */
    hTmr = CSL_tmrOpen(&TmrObj, IntcInstance, NULL, &status);
    if (hTmr == NULL)
    return -1;

    /* Set the timer mode to 64bit GP Timer Mode and set the PRD registers */
    hwSetup.tmrTimerMode = CSL_TMR_TIMMODE_GPT;
    hwSetup.tmrTimerPeriodLo = 0x0f;
    hwSetup.tmrTimerPeriodHi = 0x00;
    CSL_tmrHwSetup(hTmr, &hwSetup);

    /* Reset the timer ISR Counter. */
    //timerISRCounter = 0;

    /* Reset the Timer */
    CSL_tmrHwControl(hTmr, CSL_TMR_CMD_RESET64, NULL);

    /* Start the timer in SINGLE SHOT Mode. */
    CSL_tmrHwControl(hTmr, CSL_TMR_CMD_START64, (void *)&TimeCountMode);

    /* INTC related code */
    //while (timerISRCounter != 1);

    /* Good. The timer ISR was invoked; now we wait for some time and make
    * sure that the ISR was not invoked again since this is a ONE SHOT
    * Timer. */
    for (delayCount = 0; delayCount < MAX_DELAY; delayCount++)

    /* Timer ISR Counter should still be the same */
    //if (timerISRCounter != 1)
    // return -1;

    /**************************************************************/

    /* Disable the interrupts. */
    //CSL_intcHwControl(tmrIntcHandle, CSL_INTC_CMD_EVTDISABLE, NULL);

    /* Stop the Timer */
    CSL_tmrHwControl(hTmr, CSL_TMR_CMD_RESET64, NULL);

    /* Close the Tmr and interrupt handles */
    CSL_tmrClose(hTmr);
    //CSL_intcClose(tmrIntcHandle);

    /* Test has been completed successfully. */
    return 0;
    }


    void main (void)
    {
    int i;
    printf ("**************************************************\n");
    printf ("****************** Transmitting signal ****************\n");
    printf ("**************************************************\n");

    /* Initialize timer CSL module */
    CSL_tmrInit(NULL);
    int j=0;
    while(j<10)
    {
    for(i=0;i<10;i++)
    {
    printf("amplitue = %d\n",i);
    test_gp_timer(CSL_TMR_0);

    }

    j++;
    }

    return;
    }

     

  • Hi Adel,

    I feel, you are right person to validate your requirement. We are here to provide examples and support in case you have queries/issues. 

    Thank you.