External RAM usage of LPC22xx under KEIL FOR ARM

Publisher:a407895356Latest update time:2016-08-14 Source: eefocusKeywords:KEIL  FOR  ARM  LPC22xx Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Work notes:

       To debug external RAM, I expanded a 64K RAM on CS0, which means the address starts from 0X80000000. At first, I didn't know the setting of REALVIEW, so I couldn't read or write RAM, and there was no output signal. I had to make the following settings under KEIL.

1. Under "Options for Target 'Targe 1'", select the Asm menu, fill in EXTERNAL_MODE in the input box under "Conditional Assembly Control Symbols", and then press OK to end.

 

2. The Startup.s file also needs some changes.

EMC_SETUP EQU 1 ; Enable external RAM control.

BCFG0_SETUP EQU 1 ; Enable CS0 control. If other chip selects are used, they must be enabled.
BCFG0_Val EQU 0x1000554A; ;

; At this time, you should pay attention to the setting of the BCFG0 register and read the content carefully. It defines the read, write, and continuous clock cycles respectively. The important thing is that if it is RAM, the RVLE bit must be set to 1, and the others should be set to a suitable value according to the speed of your RAM. Bits 29 and 28 determine the width of the RAM, 8 bits, 16 bits, 32 bits, etc.

3. Another important setting is PINSEL2

PINSEL2_Val EQU 0x0F000914

 

The setting is a 16-bit bus, A1-23 address lines are enabled, CS0, OE, and WE are enabled; other pins are set to I/O. Bits 4 and 5 of this register should be clear to see how many bits of bus you have selected, and then it depends on your needs.

 

In summary, after setting these registers, the external RAM can work normally. If the above settings are incorrect, there may be no WE signal and CS0 may not be generated; the following is a simple example.

#define RAMADDR 0x80000000 //Base address of external RAM.

void ExternRam(void)
{
    volatile unint *buf;
 unint data[512];
 unint i;
 for (i=0x00;i<512;i++)
 {
     buf=(volatile unint *) (RAMADDR | i<<1);
     * buf=i;
 }
 for (i=0x00;i<512;i++)
 {
     buf=(volatile unint *) (RAMADDR | i<<1);
     data[i]=*buf;
 }
}

 

If the data you write is the same as the data you read, it means that the settings are correct. When debugging, it is best to use an oscilloscope to see whether the WE, OE, CS0 and other signals are normal.

Keywords:KEIL  FOR  ARM  LPC22xx Reference address:External RAM usage of LPC22xx under KEIL FOR ARM

Previous article:Program structure in ARM assembly language
Next article:Summary of S3C2440 circuit board layout

Recommended ReadingLatest update time:2024-11-16 21:44

[MCU] Keil+Proteus running light (modular programming)
This article: It is mainly Keil's modular programming. At the same time, a small experiment was implemented to realize the flowing light through Keil modular programming (three flowing modes were designed). Enter the text: 1. Proteus simulation diagram 1) When writing code, the first thing we need to do is to draw t
[Microcontroller]
[MCU] Keil+Proteus running light (modular programming)
ARM joins hands with GM and Toyota to develop general-purpose computing system for autonomous driving
According to foreign media reports, ARM, a British chip technology company under Japan's SoftBank Group, is working with automakers General Motors and Toyota to develop a general computing system for self-driving cars. The three companies hope to promote the development of this technology by strengthening cooperation.
[Automotive Electronics]
ARM joins hands with GM and Toyota to develop general-purpose computing system for autonomous driving
How to use LDR in ARM
In the ARM instruction set, LDR is usually used as a load instruction, but it can also be used as a pseudo-instruction. The form of the LDR pseudo-instruction is "LDR Rn,=expr". The following example illustrates its usage. COUNT EQU             0x40003100 …… LDR             R1,=COUNT MOV           R0,#0 STR 
[Microcontroller]
ARM7 MCU (Learning) - (I) Input/output port GPIO programming - 02
1. Input/output port GPIO programming 1—(02), control LCD1602 display~~ Without further ado, let's get straight to the pictures. Then the program~~ MDK1_2.c //------------------------------------------------------------------------------ //This is of course the main function #include "lpc210x.h" #include "macroan
[Microcontroller]
ARM7 MCU (Learning) - (I) Input/output port GPIO programming - 02
Arm-linux-gcc installation under ubuntu
I found the download address at random, version 4.4.3, address: http://www.cr173.com/soft/42654.html#address 1. I put it in /work/tools/ 2.sudo tar xzvf /work/tools/arm-linux-gcc-4.4.3.tar.gz 3.sudo tar xvzf arm-linux-gcc-4.4.3.tar.gz -C / 4. The command was found in /opt/FriendlyARM/toolschain/4.4.3/bin; Then sudo v
[Microcontroller]
arm-linux-gcc and simple makefile
gcc common options How to use gcc: gcc filename -v: Check the version of the gcc compiler and display the detailed process of gcc execution -o: specifies the output file name as file, which does not need to be the same as the compiled file name -E: preprocess only; do not compile, assemble or link (preprocess only, n
[Microcontroller]
ARM Basic Knowledge 7
Introduction: Data types supported by the ARM compiler ************************************************************* Data types supported by the ARM compiler ************************************************************ Data Type Length (Bits) Alignment Characteristics Char 8 1 (byte aligned) short 16 2 (100-wo
[Microcontroller]
Design and implementation of DC motor monitoring interface based on ARM/DSP embedded system of QT/E
Abstract: Design a DC motor control system in the master-slave control mode of embedded microprocessor ARM&DSP, focusing on the DC motor monitoring system interface designed based on QT/Embedded, including serial communication and motor control. Build a development environment based on embedded operating system Linu
[Industrial Control]
Design and implementation of DC motor monitoring interface based on ARM/DSP embedded system of QT/E
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号