[En-Nut-Discussion] Wait states in avr_nutinit.c
Henrik Maier
hmlists at focus-sw.com
Mon Feb 7 22:36:10 CET 2005
Hello,
while working on the AT90CAN128 port of Nut/OS, I came across the wait
state settings.
Currently avr_nutinit.c contains the following code snippet to configure
wait states:
MCUCR = _BV(SRE) | _BV(SRW10);
#ifdef NUT_3WAITSTATES
outb (XMCRA, 0x42);
outb (XMCRB, 0x00);
#endif
From my understanding MCUCR = _BV(SRE) | _BV(SRW10) configures one wait
state for the whole memory range, e.g. XRAM and NIC.
These two lines:
outb (XMCRA, 0x42);
outb (XMCRB, 0x00);
configure two memory sectors and 3 wait states for the upper range
(SRW10 and SRW11) but zero for the lower range (SRW00 = 0).
Is this intended? Or should these two lines rather be:
// Configure two sectors, lower sector = 0x1100 - 0x7FFF,
// Upper sector = 0x8000 - 0xFFFF and run 3 wait states for the
// upper sector (NIC), 1 wait state for lower sector (XRAM).
XMCRA |= _BV(SRL2) | _BV(SRW00) | _BV(SRW11); // SRW10 is set in MCUCR
XMCRB = 0;
Henrik
More information about the En-Nut-Discussion
mailing list