Tickless mode implementation

Discussions and support about ChibiOS/RT, the free embedded RTOS.
cgudrian
Posts: 5
Joined: Sun Mar 10, 2013 8:33 am

Tickless mode implementation

Postby cgudrian » Sat Nov 01, 2014 9:40 am

Hello!

Does the tickless mode still use a periodic timer? At least the STM32F4 implementation looks like it does (it uses TIM2). If so what's the difference between the traditional SysTick approach? Or am I perhaps misinterpreting the code?

Christian

User avatar
Giovanni
Site Admin
Posts: 13084
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 759 times
Been thanked: 637 times
Contact:

Re: Tickless mode implementation

Postby Giovanni » Sat Nov 01, 2014 10:01 am

Hi,

The normal mode requires periodic interrupts, the tickless mode requires interrupts at variable intervals, the next interrupt is scheduled when the next virtual timer is going to be triggered. There are no unnecessary interrupts.

No periodic interrupt means that the system time cannot be implemented as a variable incremented by systick, a timer counter is used instead. the timer is required to have an upward counting register and a comparator register, most timers are able to do this, unfortunately the Cortex SysTick timer is not among them.

Giovanni

cgudrian
Posts: 5
Joined: Sun Mar 10, 2013 8:33 am

Re: Tickless mode implementation

Postby cgudrian » Sat Nov 01, 2014 10:46 am

Hi, Giovanni!

Thanks for the quick response. Now everything makes sense. :)

Have a nice weekend,

Christian

User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Location: Minsk, Belarus
Been thanked: 7 times

Re: Tickless mode implementation

Postby barthess » Sun Nov 16, 2014 1:14 pm

Hi Giovanni,
I am recently have question about TIM vs SysTick but found this topic.
Now your decision to take regular timer instead of systick is clean for me.

User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Location: Minsk, Belarus
Been thanked: 7 times

Re: Tickless mode implementation

Postby barthess » Sun Nov 16, 2014 1:35 pm

Long sleeps (more than ~6.5 seconds on default settings) on MCUs with only 16-bit timers does not work correctly. I thinking about some aid from ChibiOS.
For example: create loop from smaller sleeps inside sleep macros.

User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Location: Minsk, Belarus
Been thanked: 7 times

Re: Tickless mode implementation

Postby barthess » Fri Dec 26, 2014 7:51 pm

Hi Giovanni,
Situation:
I want to write hal test for 1-wire driver for STM32F030x8 MCU.
I want to use TIM3 for it, but TIM3 in that MCU is only suitable timer for
systick in tickless mode.

Question:
How to correctly disable tickless mode and use Cortex's internal systick timer?
Looks like setting

Code: Select all

#define CH_CFG_ST_TIMEDELTA                 0

is not enough because compile time check fails in st_lld.h.
I think it needs some

Code: Select all

#if OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC

strings, but I do not know where to place them.

User avatar
Giovanni
Site Admin
Posts: 13084
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 759 times
Been thanked: 637 times
Contact:

Re: Tickless mode implementation

Postby Giovanni » Fri Dec 26, 2014 8:49 pm

Hi,

Putting CH_CFG_ST_TIMEDELTA to zero should be sufficient, which test is failing?

Giovanni

User avatar
barthess
Posts: 861
Joined: Wed Dec 08, 2010 7:55 pm
Location: Minsk, Belarus
Been thanked: 7 times

Re: Tickless mode implementation

Postby barthess » Fri Dec 26, 2014 9:03 pm

Code: Select all

Compiling hal.c
In file included from ../../../../../os/hal/include/st.h:50:0,
                 from ../../../../../os/hal/include/hal.h:73,
                 from ../../../../../os/hal/src/hal_queues.c:42:
../../../../../os/hal/ports/STM32/LLD/TIMv1/st_lld.h:69:2: error: #error "TIM2 not present"

when I set

Code: Select all

#define STM32_ST_USE_TIMER                  2

I know that STM32F030x8 has no TIM2, but that checks should be skipped when I use SysTick timer.
Any way, when I set

Code: Select all

#define STM32_ST_USE_TIMER                  3
#define STM32_PWM_USE_TIM3                  TRUE
#define CH_CFG_ST_TIMEDELTA                 0

my program compiles and works as expected (SysTick timer and PWM generated by TIM3)

User avatar
kreyl
Posts: 59
Joined: Sun Jan 13, 2013 11:46 pm
Been thanked: 4 times
Contact:

Re: Tickless mode implementation

Postby kreyl » Fri May 29, 2015 9:31 pm

Hi,

In tickless implementation of v3, set of regular timers of 2,3,4,5 is real pain with stm32F030 MCU. Because TIM3 is most useful one, and others are just absent.
How is it possible to use something like TIM14, or even TIM1?

Thank you!

User avatar
Giovanni
Site Admin
Posts: 13084
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 759 times
Been thanked: 637 times
Contact:

Re: Tickless mode implementation

Postby Giovanni » Sat May 30, 2015 7:21 am

Hi,

Currently it is not possible, st_lld.c would require changes.

Giovanni


Return to “ChibiOS/RT”

Who is online

Users browsing this forum: No registered users and 1 guest