Hardware resources: a circuit board with ARM7 (LPC2119) as the core, Jlink v8 emulator, LONGWEIPS-305DM DC regulated power supply, laptop (installed with Windows 7 Ultimate)
Software resources: ADS1.2 Jlink v8 driver Setup_JLinkARM_V408i
Recently, I need to use the LPC2119 chip, but I don't have an emulator for this chip. I checked online and found that the cheapest emulator AK100 produced by Zhou Ligong Company on Taobao costs 1.8K. I am short of money. LZ suddenly remembered that I used the Jlink v8 emulator when I used ADS1.2 to develop S3C2440. Can this emulator be used with the LPC2119 chip? So I quickly asked Baidu and found out that Jlink v8 supports the LPC2119 chip. I was very happy and started to try it immediately.
Since the download slot on my existing circuit board is already soldered as a single-row 8-pin slot, it cannot be used with my existing Jlink v8 2*4 slot, but the adapter board of the Jlink v8 emulator has 2*7, 2*10 and other pins. So I took the existing DuPont wires from the pins of the adapter board, and the DuPont wires were also plugged into a row of pins, and the wires led out from the adapter board and the circuit board slots matched one by one (nTRST, TDI, TMS, TCK, RTCK, TDO, nRST, VDD). After the wires were properly connected, the circuit board was powered on, and the ADS policy DEBUG was started (the prerequisite is that the JLINK driver is installed and configured, you can search for the Jlink v8 user manual on Baidu, which has detailed operation tutorials), and an error was reported, and low voltage was always displayed. This confused me. I checked whether the wires were not connected properly and whether the chip power supply was normal.... I searched Baidu for a lot of information but there was no relevant explanation. I had no choice but to carefully study the hardware structure of Jlink v8, and test the voltage of each port to see if it was normal. Finally, I found that there was a Vref on Jlink v8 that was always low, and according to the data sheet, it should be connected to Vdd as 3.3v, so I connected Vref to Vdd3.3v by flying a wire, and the problem was solved... But there was a question left, why didn't I report an error when I used Jlink v8 to burn the S3C2440 program before??
When I finished compiling the program and downloaded it to the target board, hey, I encountered another problem. I couldn't enter the interrupt. I was so annoyed that I quickly looked for the reason. First, I checked whether the initialization program related to the interrupt was correct and whether the interrupt was masked. If there was no problem, I checked whether the interrupt flag in the memory was set. Strangely, my interrupt flag was set, but I couldn't enter the interrupt service program. I checked other registers related to the interrupt and found that the CPSR register was abnormal. This was related to the startup code of ARM7. After searching the Internet, I found that there were two possible reasons for the inability to trigger the interrupt.
1. Please pay attention to your program debugging mode selection. If you select DebugInFlash or RelInFlash, the program entry address should be: 0x00000000; if you select DebugInRam, the program entry address should be: 0x40000000.
The project template I downloaded from Zhou Ligong has the entry address set correctly, so this reason is ruled out.
2. The stack initialization function is incorrectly set in the Startup.s file
The code in the original project template I downloaded is as follows
InitStack
MOV R0, LR
;Build the SVC stack
; Set management mode stack
MSR CPSR_c, #0xd3
LDR SP, StackSvc
;Build the IRQ stack
; Set up interrupt mode stack
MSR CPSR_c, #0xd2
LDR SP, StackIrq
;Build the FIQ stack
; Set up fast interrupt mode stack
MSR CPSR_c, #0xd1
LDR SP, StackFiq
;Build the DATAABORT stack
; Set up the abort mode stack
MSR CPSR_c, #0xd7
LDR SP, StackAbt
;Build the UDF stack
; Set up undefined mode stack
MSR CPSR_c, #0xdb
LDR SP, StackUnd
;Build the SYS stack
; Set up system mode stack
MSR CPSR_c, #0xdf
LDR SP, =StackUsr
MOV PC, R0
The last sentence is MSR CPSR_c,#0xdf. This is the problem, the IRQ interrupt is blocked. I have returned the assembly code to the teacher, so I won't make fun of it here. For the interpretation of the startup code, please refer to: http://blog.chinaunix.net/uid-22124213-id-403007.html
Change the above code to the following:
InitStack
MOV R0, LR
;Build the SVC stack
; Set management mode stack
MSR CPSR_c, #0xd3
LDR SP, StackSvc
;Build the IRQ stack
; Set up interrupt mode stack
MSR CPSR_c, #0xd2
LDR SP, StackIrq
;Build the FIQ stack
; Set up fast interrupt mode stack
MSR CPSR_c, #0xd1
LDR SP, StackFiq
;Build the DATAABORT stack
; Set up the abort mode stack
MSR CPSR_c, #0xd7
LDR SP, StackAbt
;Build the UDF stack
; Set up undefined mode stack
MSR CPSR_c, #0xdb
LDR SP, StackUnd
;Build the SYS stack
; Set up system mode stack
MSR CPSR_c, #0x5f
LDR SP, =StackUsr
MOV PC, R0
In fact, it just needs to change 0xdf to 0x5f.
After the modification, download, debug, and successfully enter the interrupt....
Previous article:ARM study notes 015 GPIO (assembly, key, LED wiring, int main, -wall)
Next article:Build jz2440v3 (arm s3c2440) development and gdb debugging environment under win10
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- IAR FOR MSP430 Tutorial
- Using IQmath with TMS320F28x7x
- 5G communication module, which company has mature products?
- Source code - FIR filter design.rar
- Why does the A port of 8255A become low level when simulating the circuit with proteus?
- agora RTC + old Android phone + 51 MCU remote control car = remote control car
- Design and simulation of LC balun
- In a single-chip computer, writing 1 clears it to 0, and writing 0 clears it to 0. What is the difference?
- 【Help】Sensor selection for a certain op amp circuit
- DIY thermal imaging is convenient for observing frictional heat generation