MAXQ7670
Microcontroller with 10-Bit ADC,
PGA, 64KB Flash, and CAN Interface
28 ______________________________________________________________________________________
Stack Memory
A 16-bit-wide x 16 deep internal hardware stack pro-
vides storage for program return addresses and gener-
al-purpose use. The processor uses the stack
automatically when executing the CALL, RET, and RETI
instructions and when servicing interrupts. The stack
stores and retrieves data through the PUSH, POP, and
POPI instructions.
On reset, the stack pointer, SP, initializes to the top of
the stack (0Fh). The CALL, PUSH, and interrupt-vector-
ing operations increment SP, then store a value at the
location pointed to by SP. The RET, RETI, POP, and
POPI operations retrieve the value at SP and then
decrement SP.
Utility ROM
The utility ROM is a 8KB (4K x 16) block of internal
ROM memory that defaults to a starting address of
8000h. The utility ROM consists of subroutines
accessed from application software. These include:
•In-system programming (bootstrap loader) over JTAG
and CAN
•In-circuit debug routines
•Routines for in-application flash programming and
fast table lookup
Following any reset, execution begins in the utility ROM.
The ROM software determines whether the program exe-
cution should immediately jump to location 0000h, the
start of user-application code, or to one of the above rou-
tines. Utility ROM routines are accessible in the applica-
tion software. For more information on the utility ROM
contents, refer to the
MAXQ7670 User’s Guide
.
Programming Flash Memory
The MAXQ7670 allows the user to program its flash
through the JTAG or the CAN port by allowing access
to the ROM-based bootloader through these ports. The
bootloader is entered in one of three ways: by a JTAG
request during the power-up sequence, through a CAN
request immediately after power-up when no password
has been set, and by jumping to the bootloader from
the application code. After a reset, the MAXQ7670
instruction pointer jumps to the beginning of ROM code
(0x8000). The ROM code does some initial housekeep-
ing and then looks for a request from the JTAG port. If
there is a valid request (i.e., SPE = 1, PSS = 00), the
processor establishes communication between the
ROM bootloader and the JTAG port. If there is no JTAG
request and the password has been set (0x0010 to
0x001F is not all 0s or all Fs), then program execution
jumps to the application code at address 0x0000. If the
password has not been set (0x0010 to 0x001F is all 0s
or all Fs), the ROM code monitors the CAN port for 5s
waiting to receive 0x3E. If this character is not detected
within 5s, program execution jumps to the application
code at address 0x000. If 0x3E is detected during the
five-second window, the CAN port is established as the
bootloader communication port and the MAXQ7670
responds with 0x3E, verifying that it is in the loader
mode. CAN bootloader communication speed is set to
500kbaud when using a 16MHz crystal and 250kbaud
when using an 8MHz crystal.
Once communication has been established with the
loader, the host has access to all the family 0 com-
mands regardless of the state of the PWL bit. If PWL =
0, all the loader commands are accessible. Family 0
commands all start with a 0 and provide basic function-
ality, but do not allow access to information in either
program memory or data memory. This prevents unau-
thorized access of proprietary information. A mass
erase of the flash sets all flash memory including the
password to 0xFFFF. With this condition, it is as if no
password has been set and the PWL bit is set to 0,
which allows access to all loader commands. For more
information on password protection and loader com-
mands, refer to the
MAXQ7670 User’s Guide
.
In-Application Programming
The in-application programming feature allows the µC
to modify its own flash program memory while simulta-
neously executing its application software. This allows
on-the-fly software updates in mission-critical applica-
tions that cannot afford downtime. In-application pro-
gramming also allows the application to develop
custom loader software that can operate under the con-
trol of the application software. The utility ROM contains
user-accessible flash programming functions that erase
and program flash memory. These functions are
described in detail in the
MAXQ7670 User’s Guide
.
Register Set
Register sets control the MAXQ7670 functions. These
registers provide a working space for memory opera-
tions as well as configuring and addressing peripheral
registers on the device. Registers are divided into two
major types: system registers and peripheral registers.
The common register set, also known as the system
registers, includes the ALU, accumulator registers, data
pointers, interrupt vectors and control, and stack point-
er. Tables 2–5 show the MAXQ7670 register set.