/var/www/restricted/ssh/stm32/www/stm32circle/ STM CircleOS forum / Timebase in circleOS

Username:     
Password:     
             

Forum

# 1   2009-02-10 08:19:33 Timebase in circleOS

FR4
Member
Registered: 2008-11-09
Posts: 26

Timebase in circleOS

i need a timebase with a resolution of 1ms or less. Is there a timebase in CircleOS that i can use?

Offline

 

# 2   2009-02-10 10:35:31 Timebase in circleOS

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Timebase in circleOS

Nothing available immediatly (could be easily added for the next release).
Workaround: CircleOS is called by the systick irq. I believe that the default frequency for the systick is set to 1kHz (1ms).
You can make your handler called at every tick by calling:  MENU_SetAppliDivider(1)
Now, your handler will be called at every second when the setting of the speed is SPEED_MEDIUM. For other frequency, you can deduct/adapt the frequency... The function RCC_GetClocksFreq of the ST libray is also usefull to know about the current clock configuration.

Offline

 

# 3   2009-02-10 10:50:51 Timebase in circleOS

Francis
Administrator
From: France-Grenoble
Registered: 2007-07-09
Posts: 890

Re: Timebase in circleOS

If you want your handler to be called once every ms, insert the following code in the body of your Application_Ini() function:

    ....
    UTIL_SetPll(SPEED_MEDIUM);     // Systick called once per second
    MENU_SetAppliDivider(1);            // Application handler called at every tick

Of course, when you call UTIL_SetPll, you have first to call UTIL_GetPll to save the previous user's settings and you have to restore it when exiting from your application.  In the same way, call MENU_RestoreAppliDivider to restore the default value for AppliDivider.

Offline

 

Board footer