ESP8266 Developer Zone The Official ESP8266 Forum 2016-01-05T18:15:22+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=1569 2016-01-05T18:15:22+08:00 2016-01-05T18:15:22+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1569&p=5253#p5253 <![CDATA[Re: Problem with precision of us timer]]>
NMI is more precise than FRC1, FRC1 may be effected by WiFi.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Tue Jan 05, 2016 6:15 pm


]]>
2016-01-04T20:17:27+08:00 2016-01-04T20:17:27+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1569&p=5234#p5234 <![CDATA[Re: Problem with precision of us timer]]> Interesting, that hardware timer also works without delays from FRC1_SOURCE (not in NMI mode!).
Why?

Statistics: Posted by clinkme — Mon Jan 04, 2016 8:17 pm


]]>
2016-01-04T16:33:47+08:00 2016-01-04T16:33:47+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1569&p=5231#p5231 <![CDATA[Re: Problem with precision of us timer]]>
os_timer_arm is not precise, it depends on other tasks whose priority is higher.

You can use hardware timer in NMI mode, refer to hw_timer.c.

Please notice that hardware timer can not be used with PWM at the same time.

Thanks for your interest in ESP8266 !

Statistics: Posted by ESP_Faye — Mon Jan 04, 2016 4:33 pm


]]>
2015-12-31T14:03:14+08:00 2015-12-31T14:03:14+08:00 https://bbs.espressif.com:443/viewtopic.php?t=1569&p=5205#p5205 <![CDATA[Problem with precision of us timer]]> I use it for Infrared sender engine. For example, for Panasonic
IR protocol the smallest pulse length should be 432us.
In the real program they differs slightly every time (438, 439, 455us),
but sometimes (and very often) ESP8266 fires the us timer after 707us instead
(checked with logic analyzer).
It is very big difference for the pulse, and the command is not parsed.

I'm executing system_timer_reinit() at the begining of user_init() function.
I also defined USE_US_TIMER. I am using os_timer_arm_us everytime. All timer functions
are in IRAM (no ICACHE_FLASH attribute).
The IR carrier is generated from I2SO_WS source (thus no cpu clocks earned at all),
so that should not affect the program flow.

I agreed that the time of execution of timer callback function is nowhere guaranteed,
but why so big delays?
It seems, that with this anti-precision the us timers are useless in total!!

Here is it:

Code:

+3502 -1748 +445 -445 +438 -1302 +439 -455 +441 -439 +438
-439 +438 -439 +438 -439 +439 -438 +439 -439 +438 -439 +707 -439 ......
                                                       ^^^^^
                                                                                    That is!
+438 -439 +438 -439 +439 -1301 +439 -439 +438 -439 +438 -439 +438 -439 +439
-438 +439 -439 +438 -439 +438 -439 +438 -439 +439 -1301 +439 -439 +438 -439
+438 -439 +438 -439 +439 -438 +708 -438 .............
                             ^^^^^
                               

Statistics: Posted by clinkme — Thu Dec 31, 2015 2:03 pm


]]>