Introduction to 22 common concepts about ARM

Publisher:轻松自在Latest update time:2012-07-03 Source: 21ic Keywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Explanation of some common English abbreviations in ARM

MSB: most significant bit;

LSB: least significant bit;

AHB: Advanced High-Performance Bus;

VPB: VLSI peripheral bus that connects on-chip and off-chip functions;

EMC: External Memory Controller;

MAM: Memory Acceleration Module;

VIC: Vectored Interrupt Controller;

SPI: full-duplex serial interface;

CAN: Controller Area Network, a serial communication protocol;

PWM: Pulse Width Modulator;

ETM: Embedded Trace Macro;

CPSR: Current Program Status Register;

SPSR: Program protection status register;

2. Notes on using MAM:

A: When changing the MAM timing value, you must first turn off the MAM by writing 0 to MAMCR, then write the new value to MAMTIM. Finally, write the value corresponding to the desired operating mode to MAMCR and turn the MAM on again.

For system clocks below 20MHz, MAMTIM is set to 001. For system clocks between 20MHz and 40MHz, it is recommended to set the Flash access time to 2cclk, and for system clocks above 40MHz, it is recommended to use 3cclk.

3. Precautions for using VIC

A: If the code is running in on-chip RAM and the application needs to call interrupts, the interrupt vector must be remapped to Flash address 0x0. This is done because all exception vectors are located at address 0x0 and above. This is achieved by configuring register MEMMAP (located in the system control block) to user RAM mode. The user code is connected so that the interrupt vector table is loaded at 0x4000 0000.

4. ARM startup code design

A: ARM startup code directly programs the processor core and hardware controller, generally using assembly language. The startup code generally includes:

Interrupt vector table

Initialize the memory system

Initialize the stack and initialize ports and devices with special requirements

Initialize the user program execution environment

Changing the processor mode

Calling the main application

5. Difference between IRQ and FIQ

A: IRQ and FIQ are two programming modes of ARM processors. IRQ means interrupt mode and FIR means fast interrupt mode. For FIQ you must do your business and leave this mode as soon as possible. IRQ can be interrupted by FIQ, but IRQ cannot interrupt FIQ. To make FIQ faster, this mode has more shadow registers. FIQ cannot call SWI (software interrupt). FIQ must also disable interrupts. If a FIQ routine must re-enable interrupts, it is too slow and should be IRQ instead of FIQ.

6.ARM processor's response process to abnormal interrupt

Answer: The ARM processor's response process to abnormal interrupts is as follows:

Save the current state of the processor, interrupt mask bit, and each condition flag bit;

Set the corresponding bit in the current program status register CPSR;

Set register lr_mode to the return address;

Set the program counter value PC to the interrupt vector address of the exception interrupt and jump to the corresponding exception interrupt for execution.

7. The difference between ARM instructions and Thumb instructions

Answer: In the ARM architecture, the instructions in the ARM instruction set are 32-bit instructions, and their execution efficiency is very high. For application systems with a 16-bit storage system data bus, the ARM system provides the Thumb instruction set. The Thumb instruction set is a re-encoded subset of the ARM instruction set, and the instruction length is 16 bits. Usually when the processor executes an ARM program, the processor is said to be in ARM state; when the processor executes a Thumb program, the processor is said to be in Thumb state. The Thumb instruction set does not change the programming model of the ARM system layer, but only adds some restrictions to the model. The operands of the data processing instructions in the Thumb instruction set are still 32 bits, and the instruction addressing address is also 32 bits.

8. What is ATPCS

Answer: In order to enable separately compiled C language programs and assembly programs to call each other, certain rules must be defined for calling subroutines. ATPCS is the basic rules for calling subroutines in ARM programs and Thumb programs. These rules include register usage rules, data stack usage rules, parameter passing rules, etc. [page]

9. Mixed use of ARM programs and Thumb programs

A: Generally, Thumb programs are more compact than ARM programs, and for systems with 8-bit or 16-bit memory, using Thumb programs is more efficient. However, in some cases, the program must run in ARM state, and then it is necessary to mix ARM and Thumb programs.

When speed is important, ARM programs should be used;

Some functions can only be completed by ARM programs, such as: using or disabling abnormal interrupts;

When the processor enters the exception interrupt handler, the program state switches to the ARM state, that is, some instructions at the entrance of the exception interrupt handler are ARM instructions, and then the program can switch to the Thumb state as needed. Before the exception interrupt program returns, the program switches to the ARM state again.

ARM processors always start execution from ARM state. Therefore, if you want to run a Thumb program in a debugger, you must add an ARM program header to the Thumb program, then switch to Thumb state and execute the Thumb program.

10.ARM processor operating mode

Answer: ARM microprocessors support 7 operating modes, namely:

User mode (usr): the normal program execution state of the ARM processor;

Fast interrupt mode (fiq): used for high-speed data transmission or channel management;

External interrupt mode (irq): used for general interrupt processing;

Management mode (svc): protection mode used by the operating system;

Data access termination mode (abt): This mode is entered when data or instruction prefetching is terminated, and is used for virtual storage and storage protection;

System mode (sys): runs privileged operating system tasks;

Undefined instruction abort mode (und): This mode is entered when an undefined instruction is executed and can be used to support software emulation of hardware coprocessors.

11.Exception types supported by the ARM architecture

A: The exceptions supported by the ARM architecture and their specific meanings are as follows (the numbers in the circle indicate the priority):

Reset ①: When the reset level of the processor is valid, a reset exception occurs, and the program jumps to the reset exception location for execution (exception vector: 0x0000, 0000);

Undefined instruction⑥: When the ARM processor or coprocessor encounters an instruction that cannot be processed, an undefined exception is generated. This exception mechanism can be used for software simulation (exception vector: 0x0000, 0004);

Software interrupt ⑥: SWI instruction is executed, which can be used to call privileged operation instructions in user mode. This exception mechanism can be used to implement system function calls (exception vector: 0x0000, 0008);

Instruction prefetch abort⑤: If the address of the processor's prefetch instruction does not exist, or the address does not allow the current instruction to access, the memory will send an abort signal to the processor. When the prefetch instruction is executed, an instruction prefetch abort exception will be generated (exception vector: 0x0000, 000C);

Data abort②: If the address of the instruction accessed by the processor does not exist, or the address does not allow the current instruction to access, a data abort exception is generated (exception vector: 0x0000, 0010);

IRQ④ (External Interrupt Request): When the processor's external interrupt request pin is valid and the I bit in the CPSR is 0, an IRQ exception is generated. The system's peripherals can use this exception to request interrupt service (exception vector: 0x0000, 0018);

FIQ③ (Fast Interrupt Request): When the processor's fast interrupt request pin is valid and the F bit in the CPSR is 0, a FIQ exception is generated (exception vector: 0x0000, 001C).

Note: The exception vectors 0x0000, 0014 are reserved exception vectors.

12.Memory format of ARM architecture

Answer: There are two memory formats for ARM architecture:

Big-endian format: The high byte of word data is stored in the low address, and the low byte of word data is stored in the high address;

Little-endian format: Contrary to the big-endian storage format, the high address stores the high byte of the data and the low address stores the low byte of the data.

13.ARM register summary:

ARM has 16 32-bit registers (r0 to r15).

r15 acts as the program register PC, r14 (link register) stores the return address of the subroutine, and r13 stores the stack address.

ARM has a current program status register: CPSR.

Some registers (r13, r14) will generate new instances when an exception occurs, such as IRQ processor mode, when the processor uses r13_irq and r14_irq

ARM subroutine calls are very fast because the subroutine return address does not need to be stored on the stack.

14. Reasons for memory remapping (Remap):

This allows FIQ handlers in Flash memory to avoid memory boundary issues caused by remapping.

The use of SRAM and Boot Block vectors used to handle code space mid-segment boundary arbitration is greatly reduced;

Provides space to store constants for jumps that exceed the range of single-word transfer instructions.

Remapping in ARM refers to the mapping of reallocating the memory address space by writing a certain function register bit operation during program execution. A typical application is that the application is stored in Flash/ROM. Initially, these memory addresses start from 0, but the read time of these memories is longer than SRAM/DRAM, resulting in a low internal execution frequency. Therefore, the code is generally moved to SRAM/DRAM in the previous section of the program, and then the memory space is remapped, and the corresponding SRAM/DRAM is mapped to address 0. Re-executing the program can achieve the purpose of high-speed operation.

[page]

15. The reason why the program jump in the storage exception vector table uses the LDR instruction instead of the B instruction:

The LDR instruction can jump to the full address range, while the B instruction can only jump within the range of 32MB before and after;

The chip has a Remap function. When the vector table is located in the internal RAM or external memory, the B instruction cannot jump to the correct location.

16. Phase-locked loop (PLL) points to note:

The PLL is turned off and bypassed when the chip is reset or enters power-down mode. The PLL settings will not be automatically restored after waking up from power-down.

The PLL can only be enabled through software;

After activating the PLL, you must wait for it to lock before you can connect;

Improper PLL settings will cause incorrect chip operation.

17.Differences between ARM7 and ARM9:

The ARM7 core has a three-stage pipeline and von Neumann structure with a speed of 0.9 MIPS/MHz; the ARM9 core has a five-stage pipeline and a Harvard structure with a speed of 1.1 MIPS/MHz.

ARM7 does not have MMU, ARM720T has MMU; ARM9 has MMU, ARM940T only has Memory Protection Unit, which is not a complete MMU.

ARM7TDMI provides a very good performance-to-power ratio. It includes the Thumb instruction set fast multiplication instructions and the ICE debugging technology core. The clock frequency of ARM9 is higher than that of ARM7, and the Harvard structure is used to distinguish the data bus and the instruction bus.

18.The basic operation of VIC is as follows:

Answer: Set IRQ/FIQ interrupt. If it is an IRQ interrupt, you can set it as a vector interrupt and assign interrupt priority. Otherwise, it is a non-vector IRQ. Then you can set the interrupt enable, as well as the corresponding address of the vector interrupt or the default address of the non-vector interrupt. When there is an interrupt, if it is an IRQ interrupt, you can read the vector address register and then jump to the corresponding code. When you want to exit the interrupt, write 0 to the vector address register to notify the VIC that the interrupt has ended. When an interrupt occurs, the processor will switch the processor mode, and the relevant registers will also be mapped.

19. Note when using external interrupts

After a pin is set as an external interrupt function, the pin is in input mode. Since there is no internal pull-up resistor, an external pull-up resistor must be connected to ensure that the pin is not left floating.

In addition to the setting of the pin connection module, the VIC module needs to be set to generate external interrupts, otherwise the external interrupt can only be reflected in the EXTINT register;

To make the device enter Power-down mode and wake up through an external interrupt, the software should correctly set the external interrupt function of the pin before entering Power-down mode.

20.Basic operation methods of UART0

Set I/O connection to UART0;

Set the serial port baud rate (U0DLM, U0DLL);

Set the serial port working mode (U0LCR, U0FCR);

Send or receive data (U0THR, U0RBR);

Check the serial port status word or wait for the serial port interrupt (U0LSR).

21. Basic operation methods of I2C

Answer: Basic operation method of I2C host:

Set up I2C pin connections;

Set I2C clock rate (I2SCLH, I2SCLL);

Set as the host and send a start signal (I2EN and STA bits of I2CONSET are 1, and AA bit is 0);

Send slave address (I2DAT) and control I2CONSET sending;

Determine the bus status (I2STAT) and control data transmission;

Send end signal (I2CONSET).

Basic operation method of I2C slave:

Set up I2C pin connections;

Set its own slave address (I2ADR);

Enable I2C (I2EN and AA bits of I2CONSET are 1);

Determine the SI bit or wait for I2C interrupt, wait for host operation;

Determine the bus status I2STAT and control data transmission.

22. Basic PWM operation method:

Connect the PWM function pin output, that is, set PINSEL0 and PINSEL1;

Set the clock division value (PWMPR) of the PWM timer to obtain the desired timer clock;

Set the compare match control (PWMMCR) and set the corresponding compare value (PWMMRx);

Set the PWM output mode and enable PWM output (PWMPCR) and latch enable control (PWMLER);

Set PWMTCR, start the timer, and enable PWM;

When the comparison value needs to be changed during operation, the latch enable must be set after the change.

When using double-edge PWM output, it is recommended to use PWM2, PWM4, and PWM6. When using single-edge PWM output, it is high at the beginning of the PWM cycle and low after matching. Use PWMMR0 as PWM cycle control and PWMMRx as duty cycle control.

Keywords:ARM Reference address:Introduction to 22 common concepts about ARM

Previous article:Introduction to reset circuit of ARM microcontroller
Next article:Design of embedded power parameter detection system based on ARM920T

Recommended ReadingLatest update time:2024-11-16 18:05

ARM Basics Tutorial 3
Introduction: ARM Basics - Types of Exception Interrupts in ARM **RESET** When the processor reset pin is valid, the system generates a reset exception interrupt, and the program jumps to the reset exception interrupt handler for execution. Reset exception interrupts are usually used in the following situations: whe
[Microcontroller]
Design of diffusion/oxidation control system based on ARM
With the development of informatization, intelligence and networking, embedded systems have achieved unprecedented development. Due to the characteristics of small size, strong performance and high reliability, embedded systems are currently widely used in various fields such as industrial control, control instrumen
[Microcontroller]
Design of diffusion/oxidation control system based on ARM
Arm Total Design is gaining great success
Compiled from tomshardware When Arm launched its Total Design initiative in October 2023, its success was not guaranteed. However, according to an Arm blog post, Total Design has indeed been a success. Arm's Total Design ecosystem has expanded rapidly, doubling in size in a year. The ecosystem currently
[Semiconductor design/manufacturing]
Microchip Launches PIC32CM JH Microcontroller Based on Arm® Cortex®-M0+ Architecture
According to foreign media reports, in order to provide manufacturers with MCU solutions equipped with components that comply with ISO 26262 functional safety and ISO/SAE 21434 cybersecurity engineering standards, Microchip Technology Inc. (Microchip Technology) announced the launch of the PIC32CM JH microcontroller
[Automotive Electronics]
Microchip Launches PIC32CM JH Microcontroller Based on Arm® Cortex®-M0+ Architecture
Design of LED Display System Based on AT91 M42800A
Recently, the author found in a logistics call system project based on fieldbus on a large production line in a factory that due to the large amount of information flow to be displayed, the existing LED display screen control system based on AT89C51 chip is limited by the processing speed, system architecture, addre
[Power Management]
ARM Assembly Programming Basics 4 - ARM Assembly Pseudo Operations
After mastering the basic ARM assembly instructions, to write a simple ARM assembly program, you must also master the basic ARM assembly pseudo-operations (directives). Now let's look at a simple assembly program that calls a subroutine to complete an addition operation. 1 ;File name: TEST.S 2 ;Function: Add two regi
[Microcontroller]
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* volatile g_pCurrentTask1 = NULL; volatile TASK_TCB* volatile g_pCurrentTask2 = NULL; Next, we need to initialize these task stacks. Use the fol
[Microcontroller]
Learn ARM development(21)
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
Guess you like

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号