1. Clock Tree Analysis
S3C2440A clock tree
From the upper left corner of the above figure, we can see that S3C2440A supports two external clock source inputs. One is through the external oscillator circuit connected to XTIpll and XTOpll (generally composed of a crystal oscillator as the core), and the other is through the ready-made clock frequency input through EXTCLK.
After the clock is input into the chip, it is sent to MPLL (main phase-locked loop) and UPLL (USB phase-locked loop) for frequency multiplication. The clock signal from MPLL is called FCLK, which is generally used directly to provide the clock signal to the CPU core; the clock signal from UPLL is called UCLK, which is generally used to provide the clock signal to the USB. After FCLK is divided by HDIVN and PDIVN, it will generate HCLK and PCLK. The former is generally used to provide clock signals to AHB high-speed bus and high-speed peripherals, such as USB modules, NAND FLASH controllers, etc.; the latter is generally used for APB peripheral bus to provide signals to low-speed peripherals, such as various serial communication modules, external GPIO, etc.
The following is an excerpt from the S3C2440A data sheet describing the various clock signals:
USB host interface and USB device interface needs 48Mhz clock. In the S3C2440A, the USB dedicated PLL (UPLL) generates 48Mhz for USB. UCLK does not fed until the PLL (UPLL) is configured.
FCLK is used by ARM920T. HCLK is used for AHB bus, which is used by the ARM920T, the memory controller, the interrupt controller, the LCD controller, the DMA and USB host block. PCLK is used for APB bus, which is used by the peripherals such as WDT, IIS, I
《S3C2440A 32-BIT CMOS MICROCONTROLLER USER'S MANUAL》 Revision 1.3
2. Clock Tree Initialization
Before powering on the chip, you need to configure the clock source used by modifying the OM3 and OM2 pins. The relationship between the pins and the corresponding settings is shown in the following table:
Then start setting the registers! The overall setting process is: 1. Set the delay time for the phase-locked loop to take effect; 2. Set the frequency division coefficient of PCLK and HCLK; 3. Configure the CPU to enter asynchronous mode so that the CPU can use FCLK as the clock source; 4. Set UCLK and FCLK;
The first thing you need to set is the LOCK TIME COUNT REGISTER (LOCKTIME). This register is used as the delay count for the phase-locked loop to take effect. Because it takes a certain amount of time for the phase-locked loop to generate a stable clock signal after it is set, this register is set to tell the chip how long it will take for the phase-locked loop to stabilize. Generally, we can keep the default value of this register.
LOCK TIME COUNT REGISTER (LOCKTIME)
Then, set the frequency division of HCLK and PCLK through CLOCK DIVIDER CONTROL (CLKDIVN) REGISTER. Be sure to set the frequency division registers of these two first and then start setting MPLL and UPLL. This can prevent the clock frequency on the AHB and APB buses from being too fast. The register description is as follows:
CLOCK DIVIDER CONTROL (CLKDIVN) REGISTER
The actual frequency division coefficient corresponding to the HDIVN setting value also depends on the 8th and 9th bits of the CAMDVN register. When powered on, these two bits default to 0.
Before setting UCLK and FCLK, we must first set the CPU bus to enter asynchronous working mode, so that FCLK can be used as the CPU working clock source when HDIVN is not 0. The official manual provides the assembly code for the CPU to enter asynchronous mode, the code is as follows:
/* Set the CPU to work in asynchronous mode */
mrc p15,0,r0,c1,c0,0
orr r0,r0,#0xc0000000 //R1_nF:OR:R1_iA
mcr p15,0,r0,c1,c0,0
Finally, set UPLL and MPLL to set UCLK and MCLK. According to the instructions in the manual, UCLK should be set before FCLK, so first configure the UPLLCON register, and then configure the MPLLCON register. The descriptions of the two registers are as follows:
PLL CONTROL REGISTER (MPLLCON & UPLLCON)
The desired frequency can be calculated by combining the register bit terminals MDIV, PDIV, and SDIV. However, the official provides a set of values corresponding to common frequencies for ease of use. If you want to calculate manually, you can also use the formula provided in the manual to calculate it yourself. The official reference values are as follows:
PLL VALUE SELECTION TABLE
3. Clock tree configuration reference assembly code
.text.global _start
_start:
/* Disable watchdog */
ldr r0, =0x53000000
ldr r1, =0str r1, [r0]
/* Set MPLL, FCLK : HCLK : PCLK = 400m : 100m : 50m */
/* LOCKTIME(0x4C000000) = 0xFFFFFFFF */
ldr r0, =0x4C000000
ldr r1, =0xFFFFFFFFstr r1, [r0]
/* CLKDIVN(0x4C000014) = 0X5, tFCLK:tHCLK:tPCLK = 1:4:8 */
ldr r0, =0x4C000014
ldr r1, =0x5str r1, [r0]
/* Set the CPU to work in asynchronous mode */
mrc p15,0,r0,c1,c0,0
orr r0,r0,#0xc0000000 //R1_nF:OR:R1_iA
mcr p15,0,r0,c1,c0,0
/* Set MPLLCON(0x4C000004) = (92<<12)|(1<<4)|(1<<0)
* m = MDIV+8 = 92+8=100
* p = PDIV+2 = 1+2 = 3
* s = SDIV = 1
* FCLK = 2*m*Fin/(p*2^s) = 2*100*12/(3*2^1)=400M
*/
ldr r0, =0x4C000004
ldr r1, =(92<<12)|(1<<4)|(1<<0)
str r1, [r0]
/* Once the PLL is set, the lock time will be locked until the PLL output is stable* and then the CPU will work at the new frequency FCLK*/
/* Set up memory: sp stack */
/* Distinguish whether it is NOR/NAND startup
* Write 0 to address 0, then read it out
* If you get 0, it means the content at address 0 has been modified, it corresponds to ram, this is nand boot
* Otherwise, it is NOR start
*/
mov r1, #0
ldr r0, [r1]
/* Read out the original value backup */
str r1, [r1] /* 0->[0] */
ldr r2, [r1] /* r2=[0] */
cmp r1, r2 /* r1==r2? If they are equal, it means NAND boot*/
ldr sp, =0x40000000+4096 /* Assume that it is NOR startup*/
moveq sp, #4096 /* nand start */
streq r0, [r1] /* restore the original value */
bl main
halt:b halt
Previous article:ARM cross-compilation environment installation record
Next article:Overview of S3C2440 power-on startup process
Recommended posts
- [Luckfox RV1106 Linux Development Board Review] 4. Access the Internet and Ubun through a PC shared network...
- Mypostlink: 1.Unboxingandtesting 2.SDKacquisitionandimagecompilation 3.GPIOLighting 1.AccesstheInternet TheGPIOsectionofLuckfoxalsomentionedthemethodofcontrollingIOwithPython,buttheBuildrootimagedoesno
- sonicfirr Domestic Chip Exchange
- [Good book reading together - "Hardware Design Guide: From device recognition to mobile phone baseband design"] - 01 Overview
- HardwareDesignGuide:FromDeviceKnowledgetoMobilePhoneBasebandDesign-Overview Thisbookiscalled"HardwareDesignGuide:FromDeviceCognitiontoMobilePhoneBasebandDesign",anditwaswrittenbyZhengChunhou,aformerXiaomie
- zyb329321151 Switching Power Supply Study Group
- Basic knowledge of wireless WiFi coverage
- Therearemoreandmorewirelesswificoverageprojects.FriendsintheweakcurrentVIPtechnicalgroupoftenencountersomeproblemswhendoingwificoverageprojects,especiallylargeandmedium-sizedwirelesscoverage,involvingchannelplanni
- Jacktang Wireless Connectivity
- MATLAB Design Butterworth Bandpass Filter Parameter Setting
- Whyisitthatwhenthebandpassfilterparametersaresettowp=2*/fs;ws=2*/fs;Rp=3;As=15;,thewaveformcanbeproduced,butwhenthepassbandrangeischangedtowp=2*/fs;ws=2*/fs;Rp=3;As=15;,therewillbeproblemswiththewaveform?
- 流萤宸殇 Test/Measurement
- Looking for a car charger IC with dual port output power of 40W or more C+A port
- LookingforacarchargerICwithdual-portoutputpowerofmorethan40W.TheC+Aportrequiresvariouschargingprotocols,atleastPDprotocol,andcansupportMACBOOKcharging.Pleaserecommendittotheexperts!!! None,non-compliantsituati
- fangfang120 Power technology
- How to add a bolt hole to a circuit board and connect the wire of the upper PCB to the wire of the lower PCB?
- Iwouldliketoask,toaddaholeforaboltonacircuitboardandaviatoconnectthewireontheupperPCBwiththewireonthelowerPCB,canIuseVIA? Toconnecttheupperandlowerwires,ofcourse,youmustusevias(VIA),otherwisether
- 深圳小花 PCB Design
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- Breaking through the intelligent competition, Changan Automobile opens the "God's perspective"
- The world's first fully digital chassis, looking forward to the debut of the U7 PHEV and EV versions
- Design of automotive LIN communication simulator based on Renesas MCU
- When will solid-state batteries become popular?
- Adding solid-state batteries, CATL wants to continue to be the "King of Ning"
- The agency predicts that my country's public electric vehicle charging piles will reach 3.6 million this year, accounting for nearly 70% of the world
- U.S. senators urge NHTSA to issue new vehicle safety rules
- Giants step up investment, accelerating the application of solid-state batteries
- Guangzhou Auto Show: End-to-end competition accelerates, autonomous driving fully impacts luxury...
- Lotus launches ultra-900V hybrid technology "Luyao" to accelerate the "Win26" plan
- Operational Amplifier User's Guide
- Issues with converting remaining TI points into chip points
- Development process of eCAN in DSP28335
- Sugar gliders Part ⑩ Sugar glider health monitoring system based on RSL10 - host computer design
- Can someone help me figure out whether this active filter is a voltage-controlled power supply type or a multiple feedback type?
- Ten empirical laws of electronic energy-saving lamps
- Summary by an expert: Answers to 23 classic questions in power supply development!
- MSP430F5529LP serial communication, no results
- Application of ZigBee in intelligent management of production lines
- COCOFLY Tutorial - Crazy Shell Drone Series · Quick Start · [4] Flight Control Firmware Burning