What is the proper way to use a timer?

azz-zza
Posts: 45
Joined: Tue Sep 17, 2019 2:58 am

What is the proper way to use a timer?

Postby azz-zza » Wed Oct 02, 2019 3:26 am

Hello,
i want to perform a series of steps after a timer reached a certain value.
the documentation (https://docs.espressif.com/projects/esp ... api-alarms) states:
"...
After the alarm is enabled and the timer reaches the alarm value, depending on configuration, the following two actions may happen:
An interrupt will be triggered, if previously configured. See section Interrupts how to configure interrupts.
When auto_reload is enabled, the timer’s counter will be reloaded to start counting from specific initial value. The value to start should be set in advance with timer_set_counter_value().

"
Does it mean that the only way for me to detect the timer reaching a preset value, is through the interrupt triggered by an alarm?
And, if this assumption is correct, is it proper to call xEventGroupSetBitsFromISR from said alarm?

Thank you


azz-zza
Posts: 45
Joined: Tue Sep 17, 2019 2:58 am

Re: What is the proper way to use a timer?

Postby azz-zza » Sat Oct 05, 2019 4:09 am

well, but there is also https://github.com/espressif/esp-idf/tr ... /esp_timer

And what i is the difference, i'm not sure...

All im trying to achieve is to have an alarm raised without invoking an interrupt.

username
Posts: 539
Joined: Thu May 03, 2018 1:18 pm

Re: What is the proper way to use a timer?

Postby username » Sun Oct 06, 2019 4:14 am

In the link you provided does not work off IRQ's. So if that is what you want you found it.

azz-zza
Posts: 45
Joined: Tue Sep 17, 2019 2:58 am

Re: What is the proper way to use a timer?

Postby azz-zza » Sun Oct 06, 2019 5:40 pm

username wrote:
Sun Oct 06, 2019 4:14 am
In the link you provided does not work off IRQ's. So if that is what you want you found it.
right, i'm trying to understand what is the difference ( other the use of interrupt) between these solutions? they use different API...

Mr_Red
Posts: 23
Joined: Mon Sep 11, 2017 12:41 pm

Re: What is the proper way to use a timer?

Postby Mr_Red » Mon Oct 07, 2019 2:06 pm

https://docs.espressif.com/projects/esp ... timer.html
Although FreeRTOS provides software timers, these timers have a few limitations:

Maximum resolution is equal to RTOS tick period
Timer callbacks are dispatched from a low-priority task

Hardware timers are free from both of the limitations, but often they are less convenient to use. For example, application components may need timer events to fire at certain times in the future, but the hardware timer only contains one “compare” value used for interrupt generation. This means that some facility needs to be built on top of the hardware timer to manage the list of pending events can dispatch the callbacks for these events as corresponding hardware interrupts happen.

azz-zza
Posts: 45
Joined: Tue Sep 17, 2019 2:58 am

Re: What is the proper way to use a timer?

Postby azz-zza » Sat Oct 12, 2019 2:12 pm

Mr_Red wrote:
Mon Oct 07, 2019 2:06 pm
https://docs.espressif.com/projects/esp ... timer.html
Although FreeRTOS provides software timers, these timers have a few limitations:

Maximum resolution is equal to RTOS tick period
Timer callbacks are dispatched from a low-priority task

Hardware timers are free from both of the limitations, but often they are less convenient to use. For example, application components may need timer events to fire at certain times in the future, but the hardware timer only contains one “compare” value used for interrupt generation. This means that some facility needs to be built on top of the hardware timer to manage the list of pending events can dispatch the callbacks for these events as corresponding hardware interrupts happen.

Oh.. thank you Mr_Red.. RTFM to me! //embarrassed

Who is online

Users browsing this forum: No registered users and 113 guests