S3C2440 memory controller and SDRAM

Publisher:ByteWandererLatest update time:2021-12-02 Source: eefocusKeywords:S3C2440  SDRAM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. A brief introduction to the memory controller in S3C2440

What is the role of a memory controller and what are its characteristics?

How is the memory controller used by the CPU?

How does the CPU address bus connect to the storage chip?


1. Its functions and features are shown in Figure 1. The following is a simple translation:

The S3C2440A memory controller provides the memory control signals required for external memory access.

S3C2440A has the following features:

- Little/Big Endian (software selectable).

-Address space: Each bank has 128Mb (total 1GB/8 banks).

-Except the programmable bus width of BANK0 (16/32 bits), the programmable bus width of all other BANKs has three types (8/16/32 bits).


-Total 8 BANKs:

BANK0 ~ BANK5 are used for ROM, SRAM, etc.

BANK6 ~ BANK7 can be used for ROM, SRAM, SDRAM, etc.

- The starting addresses of 7 banks, BANK0 ~ BANK6, are fixed.

-The starting address and size of BANK7 are programmable.

-The access cycle of each BANK is programmable.

- You can wait through an external wait signal to extend the bus access cycle.

- Support self-refresh and power-down modes under SDRAM.

figure 1

2. There are many on-chip peripherals (such as GPIO, UART, storage devices, etc.) on our JZ2440 development board. How does the CPU operate these peripherals? When the CPU operates non-storage devices, it directly operates the registers inside the CPU; when it operates storage devices (such as NOR FLASH, DM9000, SDRAM, etc.), it first sends a 32-bit ADDR to the memory controller, and then the memory controller sends a chip select signal according to the range of ADDR, then takes out ADDR0~ADDR26 from ADDR and sends it to the selected peripheral and exchanges data with it, and finally returns the processed data to the CPU; From point 1, we know that the memory controller has a total of 8 BANKs, each BANK is 128Mb (2^27), and the distribution of BANKs is shown in Figure 2

figure 2

3. Here we mainly introduce the example of CPU and ROM connection. The connection of other storage chips of CPU is similar (refer to S3C2440 chip manual). From Figures 3, 4 and 5, we can see that the CPU is connected to A0 of 8-bit ROM with A0, A1 is connected to A0 of 16-bit ROM, and A2 is connected to A0 of 32-bit ROM. In 8-bit ROM, one byte occupies one storage unit, and the memory controller can directly access the specific 1 Byte and return it to the CPU; in 16-bit ROM, two bytes occupy one storage unit, and the memory controller takes at least 2 Bytes at a time, and then determines the specific byte according to the value of A0 and returns it to the CPU; in 32-bit ROM, four bytes occupy one storage unit, and the memory controller takes at least 4 Bytes at a time, and then determines the specific byte according to the values ​​of A1 and A0 and returns it to the CPU;

image 3

Figure 4

Figure 5

2. Simple configuration of SDRAM

How big is the SDRAM memory on the JZ2440 and what is its q starting address?

Simple configuration of SDRAM.

1. There are two EM63A165TS-6G (16M x 16 bit) connected to JZ2440, so the total memory is 64MB. From Figure 6, we can see that the second bit of the CPU address bus is connected to A0 of SDRAM (this also matches the third point in the previous text), but why are there only 17 address lines (plus the 0th and 1st) connected to SDRAM? 2^17 is only 128kb. This is actually because SDRAM is a bit special. Its address is divided into row/column address (that is, nSRAS and nSCAS in Figure 6). It takes 2 address signals to access SDRAM once. There are generally 4 L-BANKs in SDRAM. It selects one of the L-BANKs through ADDR24 and ADDR25, and the row and column addresses of L-BANK are selected through ADDR2-ADDR2. When nSRA is valid, the row address is sent through ADDR2-ADDR14; when nSCAS is valid, the column address is sent through ADDR2~ADDR10. In Figure 6, we also know that its chip select pin is nGCS6, and combined with Figure 2, its starting address is 0x30000000. (Refer to "Complete Application Manual for Embedded Linux Development" written by Teacher Wei Dongshan)

Figure 6

2. By looking at the S3C2440 chip manual, we can see that the registers we need to set when configuring SDRAN in the memory controller are: BWSCON, BANKCON67, REFRESH, BANKSIZE, MRSRB67.

From Figure 7, we know that in the BWSCON register we only need to set BWSCON[27:24], because we have connected two 16-bit SDRAMs and generally do not need a wait signal. At the same time, ST6 is set to 0, because BANK7 and BAANK6 are generally set to the same, so BWSCON = 0x22000000;

According to Figure 8, we set BANKCON6 = 0x18001; BANKCON7 = 0x18001, where the SDRAM column address number (SCAN) we use is 9 bits. According to Figure 9, we take Trcd = 20ns, because our tHCLK is 10ns, so here Trcd = 0b00;

Figure 7

Figure 8

Figure 9

Fig.10

In the REFRESH register of FIG11, Trp is taken as 20ns and Trc is taken as 60ns according to FIG9, so REFRESH[21:20]=0b00, REFRESH[19:18]=0b01, and REFRESH[10:0]=1269 is obtained by combining FIG10 and FIG11; therefore, REFRESH = 0x8404F5; according to FIG12, BANKSIZE = 0x0B1;

Fig.11

Fig.12

Through Figure 10 and Figure 13 we set `MRSRB6 = 0x20; MRSRB7 = 0x20;

Fig.13

Below is the code that puts together the registers set above.


void sdram_init(void)

{

BWSCON = 0x22000000;


BANKCON6 = 0x18001;

BANKCON7 = 0x18001;


REFRESH = 0x8404F5;


BANKSIZE = 0x0B1;


MRSRB6 = 0x20;

MRSRB7 = 0x20;

}


The above is just a brief introduction to SDRAM and how to configure it.

Keywords:S3C2440  SDRAM Reference address:S3C2440 memory controller and SDRAM

Previous article:S3C2440 Memory SDRAM Control Notes
Next article:ARM9_S3C2440 Learning (VII) SDRAM Learning Summary

Recommended ReadingLatest update time:2024-11-22 02:38

FL2440 (2) Bare Board Program SDRAM
The following is the head.s file of jz2440, which can be used in FL2440 without modification. Note that this is the NANDFLASH boot method, and both J5 and J2 on the FL2440 development board must be plugged in. @************************************************************************* @ File:head.S @ Function: Set up
[Microcontroller]
Basic use of s3c2440 serial port
How to write UART program? 1. Serial port initialization Step 1: Set the pin ① Set the pins for the serial port. GPH2, 3 for TX0, RX0 Clear the bit, then set ② Set TX0 and RX0 internal pull-up, that is, configure the GPHUP register step2: Set baud rate (UBRDIV0) — 115200 == PCLK = 50MHz = UBRDIV0 = 26 ① Set UCON0 - Se
[Microcontroller]
s3c2440 bare metal - spi programming - 3-gpio simulate spi drive OLED
To operate the OLED, connect to the OLED through three lines (SCK, DO, CS). There is no DI here because 2440 only transmits data to the OLED but does not receive data. gpio_spi.c implements gpio simulation spi and is responsible for spi communication. For OLED, there are special instructions and data formats. T
[Microcontroller]
Introduction to ARM development board and the difference between SRAM and SDRAM
Development board model: tiny 4412 Core board: exynos4412 (Samsung SOC) ARM architecture, ARMv7 architecture coretex A9 series quad-core 1.4Ghz, 32 bit SRAM:256K ROM 16K DDR SDRMD 1Gbits Memory physical address distribution: 0x40000000 ~ 0x80000000 4GB eMMC card Bottom Plate: 4key, sliding rheostat, buzzer,
[Microcontroller]
Introduction to ARM development board and the difference between SRAM and SDRAM
Memory type and S3C2440 startup address
Preface This article records the S3C2440 startup address and various memory types 1. Memory type The mind map is as shown in the figure: 2. Explore the S3C2440 startup address 1. Why is the nand startup address 4096? Instruction: ldr sp, = 4096 Because the nand controller of S3C2440 will automatically move the f
[Microcontroller]
Memory type and S3C2440 startup address
S3C2440-5.Usage of UART
1. Introduction to UART in S3C2440 UART (universal asynchronous receive transmitter) is used to send and receive serial data and communicate in full-duplex mode. The level standard used by UART is TTL/CMOS. A frame of data usually contains a start bit, data bit, check bit, and stop bit. Both parties of UART transmissi
[Microcontroller]
S3C2440-5.Usage of UART
Getting Started | Analysis of the S3C2440 boot process
The S3C2440 startup process is a difficult point and not easy to understand. The understanding of the S3C2440 startup process affects the subsequent analysis of the bare metal code execution process, thus showing the importance of the S3C2440 startup process. S3C2440 startup mode and startup mode selection Search f
[Microcontroller]
Getting Started | Analysis of the S3C2440 boot process
[JZ2440 Notes] Bare metal experiments using SDRAM
I. Introduction After the S3C2440 selects the Nand startup mode, it will copy the first 4KB data of block 0 of the Nand Flash to the on-chip 4KB SRAM, and then the PC pointer points to the 0 address of the SRAM to sequentially fetch instructions and execute them, but the 4KB code runs The space is too small, so the 4K
[Microcontroller]
[JZ2440 Notes] Bare metal experiments using SDRAM
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号