RTOS 160MHz and Delay time

eyal
Posts: 12
Joined: Thu Apr 09, 2015 8:52 pm

RTOS 160MHz and Delay time

Postby eyal » Thu Jan 21, 2016 2:09 pm

I posted in another topic and did not see a response so this is an attempt to point to it.

I find that when I set the CPU to 160MHz, a delay of 100ms takes only 50ms. This is unexpected, is it intentional?

dsbaha
Posts: 5
Joined: Fri Jan 22, 2016 3:06 pm

Re: RTOS 160MHz and Delay time

Postby dsbaha » Sat Jan 23, 2016 2:28 pm

I believe where in the FreeRTOS headers the tick rates are fixed at 80mhz. I'd imagine if you'd change CPU FREQ to 160mhz, you'd probably have to change the define (or *2 it).

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: RTOS 160MHz and Delay time

Postby ESP_Faye » Tue Feb 02, 2016 10:42 am

Hi,

What do you want to do with the 160MHz CPU frequency instead of 80MHz ?

zaltora
Posts: 5
Joined: Wed Jun 08, 2016 3:57 am

Re: RTOS 160MHz and Delay time

Postby zaltora » Wed Jun 08, 2016 4:30 am

change theses settings work ?

#define configCPU_CLOCK_HZ ( ( unsigned long ) 80000000 )
#define configTICK_RATE_HZ ( ( portTickType ) 100 )

zaltora
Posts: 5
Joined: Wed Jun 08, 2016 3:57 am

Re: RTOS 160MHz and Delay time

Postby zaltora » Fri Jun 10, 2016 1:58 am

It is possible to reduce FreeRTOS tick from 10 ms to 1 ms ?
Change settings apparently doesn't work.

tobewinner
Posts: 45
Joined: Tue Jan 19, 2016 2:39 pm

Re: RTOS 160MHz and Delay time

Postby tobewinner » Sun Jun 12, 2016 8:00 pm

the unit of vTaskDelay() is tick, if you change CPU freq to 160Mhz, the time of a tick is changed to 5ms.

zaltora
Posts: 5
Joined: Wed Jun 08, 2016 3:57 am

Re: RTOS 160MHz and Delay time

Postby zaltora » Mon Jun 13, 2016 3:20 am

I know, and Freetos dont see it is overclocked so all delay fonction need (*2) to respect true timing.
I need to swap between task 10 more faster than now and FreeRTOS have option to do that ( TICK_RATE_HZ ). I think, it is not implemented so i want to know how change myself the tick timing if it is possible ( what timer used, interrupt and how configure it).


PS:
configCPU_CLOCK_HZ option is not implemented yet i think. It can be great for not doing (*2) on all delay (code portability).
Better option is that "system_update_cpu_freq" update frequency and delay calculation of FreeRTOS

tobewinner
Posts: 45
Joined: Tue Jan 19, 2016 2:39 pm

Re: RTOS 160MHz and Delay time

Postby tobewinner » Mon Jun 13, 2016 4:33 pm

what do you want to swap between task 10 more faster than now?

zaltora
Posts: 5
Joined: Wed Jun 08, 2016 3:57 am

Re: RTOS 160MHz and Delay time

Postby zaltora » Tue Jun 14, 2016 3:33 pm

Well i have many tasks:
Read buttons
Refresh SPI screen
Read i2c sensor
Read one_wire sensor
Wifi transmittion
Control a motor (pwm)
I use already FRC1and FRC2 timer for little periodic task.

I want reduce task time to read sensors more often. FreeRTOS is based on a timer to manage interruptions of these tick. I doubt that you can not configure it.
And maybe why not configure it for a 100 ms tick for a future project. I do not know what performance we lose or we win when we change these ticks.

tobewinner
Posts: 45
Joined: Tue Jan 19, 2016 2:39 pm

Re: RTOS 160MHz and Delay time

Postby tobewinner » Tue Jun 14, 2016 4:38 pm

zaltora wrote:Well i have many tasks:
Read buttons
Refresh SPI screen
Read i2c sensor
Read one_wire sensor
Wifi transmittion
Control a motor (pwm)
I use already FRC1and FRC2 timer for little periodic task.

I want reduce task time to read sensors more often. FreeRTOS is based on a timer to manage interruptions of these tick. I doubt that you can not configure it.
And maybe why not configure it for a 100 ms tick for a future project. I do not know what performance we lose or we win when we change these ticks.

For buttons you can use I/O interruption, besides you can switch task manually by calling taskYIELD() and some other ways. Even in Linux the HZ is often set to 100, to make the OS response more quickly, they use interrupts and some other ways (hrtimer is a good way, but may not supported by RTOS). I mean you may reach your demand by designing a proper architecture, not only by increasing the HZ(this will cost more CPU to do task switching).
If you really want to config HZ, you may need to rebuilt the libfreertos.a, party of the source is localed in RTOS_SDK/third_party.
becuase 8266_RTOS is not fully open-source, maybe it is not possible to configure the HZ.

Who is online

Users browsing this forum: No registered users and 290 guests