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.
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
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Regarding DDR4's winding length, all you need to know is in this book
- EEWORLD University ---- Amplifier Protection Series
- Introduction to calling DSP functions of TMS320F28335
- Running Debian system on K510 (unsuccessful compilation)
- UWB transceiver DW1000 chip internal diagram
- What RF people must know: A journey of discovery of electromagnetic waves
- Can anyone provide the corresponding Vbe curve of the transistor Vce/Ic amplification, saturation, and cutoff curves?
- If the input signal travels 100 meters, is it better to connect it to the positive pole or the negative pole of the optocoupler?
- Please teach me the concept of RL78 related timer
- RCD calculation method (welcome to find faults. Many experts participated)