我刚入门,昨天用汇编写了一个pwm的蜂鸣器程序,结果jtag识别不了norflash了,转到nandflash还可以用会不会是程序吧norflash烧坏了
下面贴出代码,球高人指点
LOCKTIME EQU 0X4C000000 ;默认0xffffffff
MPLLCON EQU 0X4C000004 ;0x7d 1 1 532mhz
UPLLCON EQU 0X4C000008 ;0x38 2 2 48mhz
CLKCON EQU 0X4C00000C ;0x00002100 使能pwm,gpio
CLKSLOW EQU 0X4C000010 ;慢时钟,默认关闭
CLKDIVN EQU 0X4C000014 ;0x00000003 无usb,fclk/2
TCFG0 EQU 0X51000000 ;PCLK 48MHZ
TCFG1 EQU 0X51000004 ;pwm divider 0x00000003
TCON EQU 0X51000008 ;0X0000000F autoreload On no manual update
TCNTB0 EQU 0X5100000C
TCMPB0 EQU 0X51000010
LEDCON EQU 0X56000010
LDEDAT EQU 0X56000014
GPBVAL EQU 0X00000402
MPLLVAL EQU 0X0007D011
UPLLVAL EQU 0X00038022
CLKVAL EQU 0X00002100
DIVAL EQU 0X00000003
AREA PWN,CODE,READONLY
ENTRY
CODE32
START
;INIT CLK
LDR R0,=MPLLCON
LDR R1,=MPLLVAL
STR R1,[R0]
LDR R0,=UPLLCON
LDR R1,=UPLLVAL
STR R1,[R0]
LDR R0,=CLKCON
LDR R1,=CLKVAL
STR R1,[R0]
LDR R0,=CLKDIVN
LDR R1,=DIVAL
STR R1,[R0]
;INIT PWM
LDR R0,=TCFG0
MOV R1,#0XFF
STR R1,[R0]
LDR R0,=TCFG1;从这往下三句之前没加可以响
MOV R1,#0X03;加了之后jtag就不能识别norflash了
STR R1,[R0];
LDR R0,=TCON
MOV R1,#0X0F
STR R1,[R0]
;init counter
LDR R0,=TCNTB0
LDR R1,=0X00000001
STR R1,[R0]
LDR R0,=TCMPB0
LDR R1,=0X00000001
STR R1,[R0]
;INIT LED
LDR R0,=LEDCON
LDR R1,=GPBVAL
STR R1,[R0]
B .
END |