Which Timer

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
Tabulous
Posts: 518
Joined: Fri May 03, 2013 12:02 pm
Has thanked: 7 times
Been thanked: 18 times

Which Timer

Post by Tabulous »

I'm i right to assume

#define STM32_ST_USE_TIMER 2

means the OS will use GPT2 for the OS tick ? and thus this cannot be used by the user application ?
User avatar
RoccoMarco
Posts: 655
Joined: Wed Apr 24, 2013 4:11 pm
Has thanked: 83 times
Been thanked: 67 times

Re: Which Timer

Post by RoccoMarco »

Yes you are right. It could be change with TIM 5 which is another 32-bit timer. Or you can reduce the timer resolution to 16 in chconf.h (not suggested)

Code: Select all

/**
 * @brief   System time counter resolution.
 * @note    Allowed values are 16 or 32 bits.
 */
#define CH_CFG_ST_RESOLUTION                16
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Which Timer

Post by Giovanni »

Correct but it does not use the GPT driver, there is a special ST (SysTick) driver that supports variable intervals.

Giovanni
neums
Posts: 137
Joined: Fri May 08, 2015 1:09 pm
Has thanked: 10 times
Been thanked: 5 times

Re: Which Timer

Post by neums »

Hi,
when the ST driver uses (for example) STMs SysTick Timer, why do i have to define

Code: Select all

#define STM32_ST_USE_TIMER 2

?

There is just one Systick Timer

Thanks
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Which Timer

Post by Giovanni »

Hi,

The ST driver can use both the SysTick and the TIM timers, SysTick is used in ticked mode regardless that setting, TIMs are used in tickless mode and you can select which one to use.

Giovanni
neums
Posts: 137
Joined: Fri May 08, 2015 1:09 pm
Has thanked: 10 times
Been thanked: 5 times

Re: Which Timer

Post by neums »

Ticked mode is if

Code: Select all

OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC

and tickless if

Code: Select all

OSAL_ST_MODE == OSAL_ST_MODE_FREERUNNING

?
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Which Timer

Post by Giovanni »

Correct.

Giovanni
Post Reply