lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] sys_timeout firing too often.


From: Nick Thomas
Subject: [lwip-users] sys_timeout firing too often.
Date: Fri, 5 Sep 2008 12:08:21 +0100

Hi,

Having trouble with sys_timeout() function.

My call to sys_timeout, using a timeout value of 5000 (i.e. 5 seconds).
But, the timeout handler function is being called roughly twice per second!

I don't understand what is wrong, but I thought it was something to do with
these macros in sys_arch.h

/* OS20 time conversion macros */
#define time_ticks_per_sec() ST_GetClocksPerSecond()
#define tick_to_msec(tick)      ((u32_t)((tick) * 1000 / time_ticks_per_sec()))
#define msec_to_tick(msec)      ((clock_t)((msec) * time_ticks_per_sec() / 
1000))
#define tick_to_usec(tick)      ((u32_t)((tick) * 1000000 /
time_ticks_per_sec()))
#define usec_to_tick(usec)      ((clock_t)((usec) * time_ticks_per_sec() /
1000000))

The msec_to_tick appears to overflow with a large number (like 5000) - or am
I wrong.

Anyway, is there another way to implement a timer with a 5 second interval?
and why does my timer fire roughly twice per second?

On my system the ST_GetClocksPerSecond() equates to 6250,000 .


Regards

Nick Thomas






reply via email to

[Prev in Thread] Current Thread [Next in Thread]