AN1069 STMICROELECTRONICS | Alldatasheet
Document overview
- Manufacturer or author: Provided By ALLDATASHEET.COM(FREE DATASHEET DOWNLOAD SITE)
- PDF pages: 14
Technical content
controllers that have a 22-bit external address bus.
1 ST9 EXTERNAL MEMORY MANAGEMENT
for more information on the MMU). of external memory directly. Figure 1. ST9+ Memory Access Overview
64 Kbytes or 128 Kbytes (ST92F120 only) of external memory without any additional software
to output the 22-bit address.
2 ACCESSING UP TO 64 KBYTES OF EXTERNAL MEMORY WITHOUT
vices and the microcontroller. These connections are described in Figure 2.. Figure 2. Accessing 64 Kbytes of external memory resistor is needed only when using ROMLESS devices. Examples of memory mapping are given in Figure 3. and Figure 4..
3 ACCESSING UP TO 2 OR 4 MBYTES WITH ANY ST9+
3.1 PRINCIPLE
or almost to 4M bytes with an OTP, ROM, or Flash device. Port 2 will be used by software to select the Dynamic Segment you want to access. areas. For simplicity, both types of segment are numbered in the same way. Figure 5. ST9+ Schematic
Figure 6. Static and Dynamic Segments
3.2 DEFINITION
and the amount of memory in each segment depends on the microcontroller. memory which is not connected to Port 2 and is therefore not dynamic. At least one static segment is needed in any application. has been selected by the user. Its access depends on the P2DR (Port 2 data register) value. The size of a dynamic segment can be from 0 to 64K.
3.3 HARDWARE IMPLEMENTATION
3.3.1 Example using a microcontroller with internal memory
memory can be used as a Static Segment. The hardware connections are shown in Figure 7.. Figure 7. Accessing almost 4M with the ST90158 would need a dedicated logical unit.
seen by the microcontroller as shown in Figure 8.. Figure 8. Memory map for accessing 4M of external memory with the ST90158
3.3.2 Example Using a ROMless microcontroller
Like in ST90158 OTP devices, Segments 20, 21, 22 of external memory cannot be accessed. Figure 10. shows the memory map with segments containing 32K of memory.
Figure 9. Accessing almost 2M with the ST90R158 would increase the complexity of the hardware and software.
32 Kbytes
2 Mbytes
Figure 10. Memory mapping for accessing 2M of external memory with ST90R158
ADDRESSING UP TO 4 MBYTES OF EXTERNAL MEMORY
3.4 SOFTWARE IMPLEMENTATION
3.4.1 Calling functions or manipulating data in a dynamic segment
Before calling a function or manipulating data in a Dynamic Segment we need to write the cor- rect value in the Port 2 data register (P2DR) to select the segment. This can be done automat- ically using a macro called “set_seg()” which is in the “extmem.h” file. This macro uses the function name or the data address as a parameter: set_seg(my_function_name) set_seg(&data_name) This macro must be used each time we want to call a function or manipulate data which is in a dynamic Segment other than the current one. It is not necessary to use this macro to call a function in the same dynamic segment as the caller function or to manipulate data in the same dynamic. Nevertheless, for data manipulation is advised to set the segment using the macro for code portability. Once this macro is implemented in your code, if you change the location of your code to another Dynamic Segment, the segment number is computed automatically. Nevertheless make sure you change the associated data segment too, since code cannot ac- cess data located in another Dynamic Segment. The number of instructions and cycles generated by this macro depends on the location of the P2DR register, it can go from 3 bytes, 6 cycles to 5 bytes 10 cycles. Depending on the DPRREM bit in the EMR2 Register, the P2DR register can be located in group E of the Reg- ister File (RF) or in group F page 21 of the RF. Read the datasheet and C-compiler manual carefully since the programming model has an impact on the DPRREM register.
3.4.2 Direct Memory Access (DMA)
The following paragraph is about DMA transfer between a peripheral and memory. There are no restrictions on DMA transfer between a peripheral and the Register File. In most applications, the DMA can occur at any moment during program execution. Data to be transferred needs to be located in the Static Segment. Nevertheless, if it is really needed, we can put the data in the Dynamic Segment. But during DMA, we can only run code in the Static Segments or in the same Static Segment as the one where the data is located.
3.4.3 INTERRUPTS
Interrupts can occur at any time during code execution. Therefore, interrupt vectors and rou- tines should be located in the Static Segment in order to be accessible at any time. Nevertheless, a routine from a Dynamic Segment can be called by the interrupt routine. In this case, refer to the datasheet to be sure you have configured your microcontroller to save the CSR (refer to the description of the ENCSR bit in the EMR2 register).
3.4.4 Emulation
GCC9 user manual for more information on the secinfo section. have a buffer. Therefore the maximum amount of memory available during emulation is 2MB.
3.4.5 Capabilities and limitations
Table 1. Software capabilities and limitations Legend: SS = Static Segment, DS = Dynamic Segment.
ADDRESSING UP TO 4 MBYTES OF EXTERNAL MEMORY
3.5 SOFTWARE EXAMPLE
A software example using the ST9 demonstration board and the ST90158EMU2B is available. You will find in it examples all the possible code manipulations (call...) and use of data (con- stants, initialized variables...). You will be able to observe the transfer process for the emula- tion capability. The example downloads the program into the external RAM of the demonstra- tion board.
ADDRESSING UP TO 4 MBYTES OF EXTERNAL MEMORY "THE PRESENT NOTE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH A NOTE AND/OR THE USE MADE BY CUSTOMERS OF THE INFORMATION CONTAINED HEREIN IN CONNEXION WITH THEIR PRODUCTS." Information furnished is believed to be accurate and reliable. However, STMicroelectronics assumes no responsibility for the consequences of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted by implication or otherwise under any patent or patent rights of STMicroelectronics. Specifications mentioned in this publication are subject to change without notice. This publication supersedes and replaces all information previously supplied. STMicroelectronics products are not authorized for use as critical components in life support devices or systems without the express written approval of STMicroelectronics. The ST logo is a registered trademark of STMicroelectronics 2000 STMicroelectronics - All Rights Reserved. Purchase of I2C Components by STMicroelectronics conveys a license under the Philips I2C Patent. Rights to use these components in an I2C system is granted provided that the system conforms to the I2C Standard Specification as defined by Philips. STMicroelectronics Group of Companies Australia - Brazil - China - Finland - France - Germany - Hong Kong - India - Italy - Japan - Malaysia - Malta - Morocco - Singapore - Spain Sweden - Switzerland - United Kingdom - U.S.A. http://www.st.com