AnsweredAssumed Answered

How to Start Timers Using Macros?

Question asked by spflanze on Feb 20, 2013
Latest reply on Mar 5, 2013 by SachinV

For speed reasons I need to enable a timer by direct access to its control registers using macros.

 

I succeed to get it started when using adi_tmr_GPControl( ADI_TMR_GP_TIMER_6, ADI_TMR_GP_CMD_ENABLE_TIMER, (void *)TRUE ). When I attempt to do the equivalent using the pTIMER_ENABLE0 and pPORTA_MUX it fails to start. I need to know what I am missing. Attached is a screen shot of the Timer Registers. They look the same when I break after either method.

 

The relevant code fragments:

 

ADI_TMR_GP_CMD_VALUE_PAIR TMR_ADC_SETUP[] = {

    { ADI_TMR_GP_CMD_SET_TIMER_MODE, (void *)0x01 }, // Sets the operating mode of the timer 0x01 = PWM.

    { ADI_TMR_GP_CMD_SET_PULSE_HI, (void *)TRUE }, // Sets the pulse action of the timer TRUE = positive action pulse.

    { ADI_TMR_GP_CMD_SET_COUNT_METHOD, (void *)FALSE }, // Sets the count method FALSE = count to end of width

    { ADI_TMR_GP_CMD_SET_INTERRUPT_ENABLE, (void *)TRUE },

    { ADI_TMR_GP_CMD_SET_OUTPUT_PAD_DISABLE, (void *)FALSE }, // Enables or disables the TMRx pin. FALSE = Enabled TRUE = Tristated

    { ADI_TMR_GP_CMD_SET_CLOCK_SELECT, (void *)FALSE }, // Selects the input clock for the timer. FALSE = SCLK

    { ADI_TMR_GP_CMD_RUN_DURING_EMULATION, (void *)FALSE }, // Enables or disables the timer when the device is servicing

                                                                                                                    // emulator interrupts. FALSE = do not run during emulation

    { ADI_TMR_GP_CMD_SET_TOGGLE_HI, (void *)FALSE }, // Sets the toggle mode. TRUE: PULSE_HI alternated each period FALSE use programmed state

    { ADI_TMR_GP_CMD_ENABLE_TIMER, (void *)FALSE }, // Timer is off until enabled in adc_enable()

    { ADI_TMR_GP_CMD_END, NULL }

};

 

adi_tmr_GPControl( ADI_TMR_GP_TIMER_6, ADI_TMR_GP_CMD_TABLE, TMR_ADC_SETUP );

 

     // This works:

     //adi_tmr_GPControl( TMR_CONVST_ADC, ADI_TMR_GP_CMD_ENABLE_TIMER, (void *)TRUE );

 

     // The below attempted equivalent does not work:

            *pPORTA_MUX |= (u32)(1<<18) ;

            *pPORTA_MUX &= ~(u32)(1<<19);

                   

            *pTIMER_ENABLE0 |= 0x40;

Attachments

Outcomes