Independent Virtual Timers and ST

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Independent Virtual Timers and ST

Postby vrollei » Tue Apr 11, 2017 4:31 pm

Hi,

it would be great to have Independent Virtual Timers and ST based on STM32L0/L1/L4 TIM with LSE clock source to get precise time in low power modes.
There is a problem with time measurement with general ST based on 32bit TIM with HSI/MSI clock source due to instability of frequency and delays in low power mode clock source switching (and threads switching as well), it suits well for general purpose but not for precise time measurements used e.g. in LORA applications.

So what do you think about this feature?
Vitaly

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

Re: Independent Virtual Timers and ST

Postby Giovanni » Tue Apr 11, 2017 8:53 pm

Hi,

By "independent" you mean in addition to normal virtual timers?

Giovanni

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Independent Virtual Timers and ST

Postby vrollei » Tue Apr 11, 2017 9:12 pm

Hi,

yes, virtual timers working independent from ST.
Simplest and weird implementation for stm32l1 on tim11 (LSE clock) attached.
Start timer on first VT and stop timer on empty VTs list has not been added yet (to support lowest power consumption)
Attachments
chivt.zip
(8 KiB) Downloaded 151 times
Vitaly

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Independent Virtual Timers and ST

Postby vrollei » Tue Apr 11, 2017 9:19 pm

quote from stm32l1 RM:

Clock-independent system clock sources for TIM9/TIM10/TIM11
In a number of applications using the 32.768 kHz clock as a time base for the RTC, it is interesting to have time bases that work completely independently of the system clock. This allows the scheduling of tasks without having to take into account the processor state (the processor may be stopped or executing at low, medium or full speed).
For this purpose, the LSE clock is internally redirected to the 3 timers’ ETR inputs, which are used as additional clock sources, as shown in Figure 17 on page 137. This gives up to three independent time bases (using the auto-reload feature) with 1 or 2 compare additional channels for fractional events. For instance, the TIM9’s auto-reload interrupt can be programmed for a 1 second tick interrupt with an additional interrupt occurring 250 ms after the main tick.
Vitaly

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

Re: Independent Virtual Timers and ST

Postby Giovanni » Wed Apr 12, 2017 7:47 am

This is very interesting, at very least the ST driver should support LSE as clock source.

Anyway, in trunk there is an "alternate" virtual timers implementation under /os/hal/osal/lib, it is used for RTOS-less OSALs but it can be used also standalone. It needs some symbol names changes because some names conflicts with RT symbols.

Giovanni

vrollei
Posts: 163
Joined: Sun Nov 13, 2016 8:44 am
Been thanked: 26 times

Re: Independent Virtual Timers and ST

Postby vrollei » Wed Apr 12, 2017 8:16 am

Hi,

support LSE as clock source for ST is great, but there is no 32bit timer with LSE clock source so there is no way to get really long sleep with 1ms tick.
If only implement ST driver with support speeded RTC as timer.
Vitaly


Return to “Development and Feedback”

Who is online

Users browsing this forum: No registered users and 20 guests