[ECOS] Re: In trouble of timer operations

Paul D. DeRocco pderocco@ix.netcom.com
Thu Jun 5 17:39:00 GMT 2008

> From: ariga masahiro
> Thank you,Paul,for valuable suggestion.
> I re_calculated by toggling LED and measured signal's duration on
> osilloscope.
> result
> (1) only used cyg_thread_delay(2)                -- 20.2millisec
> (2) cyg_thread_delay(1),cyg_thread_delay(2)      -- 30.1millisec
> (3) same as (2) except changed cyg_thread_delay(2) to
> yg_thread_delay(20)  -- 212millisec
> (4) only used cyg_thread_delay(20)               -- 201millisec
> I am confirmed in thinking that since
> clock is running 100Hz,1 tick perid = 10millisec,and if I wish to
> run system
> clock 200Hz I should change CYGNUM_HAL_RTC_DENOMINATOR to 200.
> But according to your mail, it raised another puzzlement.
> > However, you won't find it out very easily with diag_printf, because it
> > probably takes longer than 10ms to execute.
> At first,I couldn't get it. Because if diag_printf takes over
> 10ms, simply
> calculated results ought be longer,
> but on the contrary it took far shorter than expected.
> So I deliberately inserted
> HAL_CLOCK_READ1(&start);
> diag_printf("id=hi 0x%x\n",start);
> in above each test(after led_toggle function) and investigated how it
> affects duration time.
> To my very astonishment as far as looking signals on osilloscope
> there are
> no differences !
> Two functions takes no time at all as far as looking to signals.

Well, then the diag_printf is running fast enough on your system. That
depends upon the bit rate. On a system running at 115200, outputting 18
characters takes about 1.5ms, which is short enough, but running at 9600
takes 19ms, which would cause a problem.

If your loop is running at the right rate according to the scope, but your
diag_printf messages show something different, then it sounds like you've
proven that your HAL hardware clock isn't running at the speed you think it


Ciao,               Paul D. DeRocco
Paul                mailto:pderocco@ix.netcom.com

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list