Bits 16-31
Bits 10 - 15
Bits 0 - 9
MFBAHRx
MFBALRx
Bits 10 - 15
Address Decoder (DEC)
499
SNIU028A – February 2016 – Revised April 2016
Copyright © 2016, Texas Instruments Incorporated
Control System Module
16.1.2 Why Change Memory Map?
The memory map changes primarily because the vectors – for reset, interrupts, and faults – are located
starting at location 0 in memory. When the UCD3138 powers up, the ROM needs to control the vectors.
When the memory is configured, but the ROM is still executing, the ROM still needs to control the vectors.
Then when control is handed over to the customer program in FLASH, the vectors need to be assigned by
the customer for most efficient execution.
16.1.3 How do Memory Map Registers Work?
Two registers, the Memory Fine Base Address High Register, and the Memory Fine Base Address Low
Register, combine to provide a start address for the memory block.
Figure 16-2. Base Address
The Block Size field in the Memory Fine Base Address Register Low determines the size of the area for
the memory block. The possible sizes range from 1KB, represented by a 1 in BLOCK_SIZE, to 16MB,
represented by a 0xF. A zero in BLOCK_SIZE disables that memory from ever being selected.
To calculate the address provided by the MBBALRx, multiply it by 4 and include it in bits 8 to 15. For
example, a 0x22 translates to 0x8800. A 0x24 translates to a 0x9000. There are other bits as well, for
example an RONLY bit signifying that the memory is read only.
There is also a MS (for Memory Select) bit in only MFBALR0, which enables the entire DEC module. DEC
stands for Memory Address DECode.
16.1.4 RONLY Bit
The DEC register has an RONLY bit as well. If set, this means “read only”. An attempt to write to a
memory space with the RONLY bit set will cause an illegal access exception, which will normally reset the
processor. This bit may be set to cause device reset if the program runs away either due to a program
bug or an input glitch.
16.1.5 Boot ROM Memory Initialization
When the UCD3138 powers up, the ROM is the only memory in the entire memory space. The peripherals
are also present at the extreme high end of the memory space. The ROM image is repeated throughout
the rest of the memory. The reset vector at location 0 in memory is accessed by the first instruction fetch
of the CPU.
This instruction is a branch to the ROM entry point, aimed at the ROM image starting at address 0xa000.
This is done because eventually the ROM will be mapped to 0xa000 to 0xafff only. If the program counter
is already pointing there, there is no discontinuity when the address is changed.
First in the ROM program, the three address register pairs for the other memories are changed.
Memory Fine Base Address High Registers 1-3 (MFBAHRx) are all loaded with a 1. This register provides
bits 16 – 31 of the address for the device, so all of the memories will be mapped to 0x1xxxx.