[En-Nut-Discussion] NutGetMillis is a _very expensive_ function on Ethernut3

Harald Kipp harald.kipp at egnite.de
Tue Aug 19 19:10:41 CEST 2008


Hi Ole,

Ole Reinhardt wrote:
> I found that even several functions of NutOS itselt request the current
> CPU clock always from the clock generator over I2C. For example every
> ARP requests does so.

Indeed, this is horrible.

> At least it should be possible to store the last system clock value
> written to the cy22393 so that we don't need to request it every time
> again. It should not change by itself, right?

This would create two problems:

1. The programmer won't be able to use his own (existing) CY22393 routines.

2. If done at the lower level, care has to be taken for every hardware 
implementation.

To avoid this, I'd suggest to add a new routine NutRefreshClock() in 
os/timer.c, which updates a variable that stores the tick clock. This 
routine will be automatically called during initialization and must be 
called by the application when changing the clock registers.

Harald





More information about the En-Nut-Discussion mailing list