小生最近用SH4作个DD,复位脚的接法,我用的是QG8原厂的DEMO 把MCU拔了作为仿真器使用,但只能进入DEBUG模式一次,以后就 怎么也进不去了 2:我用QG8装回去,可以把代码烧写到QG8里面,说明仿真器没有 损坏 3:我看了GQ8 DEMO的原理图,看见它的RESET脚没有接任何器件, 所以我也拆掉了SH4 RESET脚的5.6K 0.1uF,但仍然不能进入 DEBUG 4:这个是我的初始化代码 void InitializeSystemClock(void) { /* SOPT1: COPT=0,STOPE=1,IICPS=0,BKGDPE=1,RSTPE=1 */ SOPT1 = (unsigned char)0x23;
/* SPMSC1: LVWF=0,LVWACK=0,LVWIE=0,LVDRE=1,LVDSE=1,LVDE=1,BGBE=0 */ SPMSC1 = 0x1C; /* SPMSC2: LVDV=0,LVWV=0,PPDF=0,PPDACK=0,PPDC=0 */ SPMSC2 = 0x00; ICSTRM = *(unsigned char*far)0xFFAF; /* Initialize ICSTRM register from a non volatile memory */ ICSSC = *(unsigned char*far)0xFFAE; /* Initialize ICSSC register from a non volatile memory */
/* ICSC1: CLKS=0,RDIV=0,IREFS=1,IRCLKEN=0,IREFSTEN=0 8M fbus->4M*/ ICSC1 = 0x04;//ICSC1 = 0x14; /* Initialization of the ICS control register 1 */ /* ICSC2: BDIV=01,RANGE=0,HGO=0,LP=0,EREFS=0,ERCLKEN=0,EREFSTEN=0 */ ICSC2 = 0x40;// /* Initialization of the ICS control register 2 */ while(!ICSSC_IREFST) { /* Wait until the source of reference clock is internal clock */ }
/* ### Init_COP init code */ SRS = 0xFF; /* Clear WatchDog counter */ } //下面是端口的 /*A口初始化*/ PTADD = (unsigned char)0xFF; PTAPE = (unsigned char)0x00;//禁止A口上拉 PTASE = (unsigned char)0x00;//不限制A口摆率 PTADS = (unsigned char)0x0F; PTASC = (unsigned char)0x00; PTAPS = (unsigned char)0x00; PTAES = (unsigned char)0x00; PTAD = (unsigned char)0x00;
/*B口初始化*/ PTBDD = (unsigned char)0x06; PTBPE = (unsigned char)0x00;//禁止B口上拉 PTBSE = (unsigned char)0x00;//不限制B口摆率 PTBDS = (unsigned char)0x00; PTBSC = (unsigned char)0x00; PTBPS = (unsigned char)0x00; PTBES = (unsigned char)0x00; PTBD = (unsigned char)0x00; /*C口初始化*/ PTCDD = (unsigned char)0xFB;//方向口控制 PTCPE = (unsigned char)0x00;//禁止上拉 PTCSE = (unsigned char)0x00;//不限制摆率 PTCDS = (unsigned char)0x00;//禁止强驱动 //GNGC = (unsigned char)0x00;? PTCD = (unsigned char)0x00; | R5.6K | RESET ---- | 0.1uF | GND
|