
#)
User
’
s Manual
18-9
1999-08
18.3
Application-Specific Initialization Routine
After a reset the modules of the C161PI must be initialized to enable their operation on
a given application. This initialization depends on the task the C161PI is to fulfill in that
application and on some system properties like operating frequency, connected external
circuitry, etc.
The following initializations should typically be done, before the C161PI is prepared to
run the actual application software:
Memory Areas
The external bus interface
can be reconfigured after an external reset because register
BUSCON0 is initialized to the slowest possible bus cycle configuration. The
programmable address windows can be enabled in order to adapt the bus cycle
characteristics to different memory areas or peripherals. Also after a single-chip mode
reset the external bus interface can be enabled and configured.
The internal program memory
(if available) can be enabled and mapped after an
external reset in order to use the on-chip resources. After a single-chip mode reset the
internal program memory can be remapped or disabled at all in order to utilize external
memory (partly or completely).
Programmable program memory can be programmed, e.g. with data received over a
serial link.
Note: Initial Flash or OTP programming will rather be done in bootstrap loader mode.
System Stack
The deafult setup for the system stack (size, stackpointer, upper and lower limit
registers) can be adjusted to application-specific values. After reset, registers SP and
STKUN contain the same reset value 00
’
FC00
H
, while register STKOV contains
00
’
FA00
H
. With the default reset initialization, 256 words of system stack are available,
where the system stack selected by the SP grows downwards from 00
’
FBFE
H
.
Note: The interrupt system, which is disabled upon completion of the internal reset,
should remain disabled until the SP is initialized.
Traps (incl. NMI) may occur, even though the interrupt system is still disabled.
Register Bank
The location of a register bank is defined by the context pointer (CP) and can be adjusted
to an application-specific bank before the general purpose registers (GPRs) are used.
After reset, register CP contains the value 00
’
FC00
H
, i.e. the register bank selected by
the CP grows upwards from 00
’
FC00
H
.