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.

Using 1ms DMTIMER

Hi, I followed the "demo" example in Starterware to program the 1ms DMTIMER as follows -

/* Initialize the ARM Interrupt Controller */
        IntAINTCInit();

        IntMasterIRQEnable();

        IntSystemEnable(SYS_INT_TINT1_1MS);
       // IntPrioritySet(SYS_INT_TINT1_1MS, 0, AINTC_HOSTINT_ROUTE_IRQ);
        IntRegister(SYS_INT_TINT1_1MS,clearTimerInt);

        initializeTimer1();

However,  I dont see the interrupt generate. The execution is stuck  in enableModule() call in clock.c

/*    Wait till the module is fully functional    */
    while(((moduleClk->idleStatusMask) & (~moduleClk->idleStatusMask))!=
          (HWREG(moduleClk->clockCtrlReg) & (moduleClk->idleStatusMask)));
}

I am using beaglebone.

Could somebody give some hints ?

Is there a document (apart from the TRM ) that indicates the clock domains to be enabled for 1ms Timer ?

Kind Regards,

Sreekumar

  • Update:

    The code is trying to write into and read from

    CM_WKUP_TIMER1_CLKCTL

    The value of the register is   0X0030002


    IDLEST = 0X11   =>  0x3 = Disable : Module is disabled and cannot be accessed
    MODULEMODE = 0X10  =>0x2 = ENABLE : Module is explicitly enabled.

  • Hi Sreekumar,

    Firstly, Starterware does not have ClockConfiguration API for DMTimer1ms.

    So Before you configure the CLKCTL register for using 1ms Timer, you must select the appropriate clock source,

    CLKSEL_TIMER1MS_CLK  (offset 28h)

    This register selects the clock source for the DMTimer1MS instance.

    The TRM mentions some default count values for 32k clock source in Timer1ms chapter, you can use these values for a start.

    DMTimer1ms comes under wakeup power domain, hence its clock configuration registers are listed under CM_WKUP.

    Refer TRM Chapter 8 PRCM for more information.

    Also, starterware example demonstrating usage of DMTimer as a counter might be useful to you.

    Hope this helps you.

    Regards

    Anant Pai

     

  • Hi Anant,

    Why does the Starterware code for timer2 clock configuration (dmtimer.c)  use L3 clocks . ?

    void DMTimer2ModuleClkConfig(void)
    {
        HWREG(SOC_CM_PER_REGS + CM_PER_L3S_CLKSTCTRL) =
                                 CM_PER_L3S_CLKSTCTRL_CLKTRCTRL_SW_WKUP;

     ...

    Regards,

    Sreekumar

  • Hi Sreekumar,

    Current clock configuration APIs of Timer module for the platforms beaglebone and evmAM335x have some redundant code,

    which is not related to the clock configuration required for the Timer Instance. This will be corrected in the future release of Starterware.

    As of now, you can refer to clock configuration of timers for evmskAM335x Platform, i.e

    platform\evmskAM335x\dmtimer.c file will give the correct implemenation for DMTimer2ModuleClkConfig.

    You can use this code for beaglebone as well without any problems.

    Regards

    Anant Pai

  • Thank you Anant, I could get the timer interrupts from 1ms DMTIMER.

  • I meet same problem. how to change oode to get 1ms DMTIMER.

    in my case, sometimes, it can run. but, sometimes, it block at

        while(((moduleClk->idleStatusMask) & (~moduleClk->idleStatusMask))!=           (HWREG(moduleClk->clockCtrlReg) & (moduleClk->idleStatusMask)));

     

  • Hi.

    have uploaded my source file to http://pastebin.com/raw.php?i=nawEKRXU

  • Dear Sreekumar TP,

         Could you send the source code to my email, cheneychina@hotmail.com?  thank you very much.

         I'm a chinese user. Because of some obvious reason, I can't access http://pastebin.com. I spent 3 hour to try to access this web. but I failure, I give up....

         Best regards

    Cheney