Using ADS1.2 and JLINK V8 to build ARM7 development platform

Publisher:数据小巨人Latest update time:2020-06-21 Source: eefocusKeywords:ADS1  JLINK  ARM7 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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....

Keywords:ADS1  JLINK  ARM7 Reference address:Using ADS1.2 and JLINK V8 to build ARM7 development platform

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

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号