请问老师,JZ2440串口查询模式是OK的,用于debug;然后移植系统中会启用中断收发模式,出现打印错行、输入字符后自带回车等问题。不知道是时钟、还是UART初始化或者哪里有问题。
.S文件
/* close watchdog */
ldr r0, =0x53000000
mov r1, #0x0
str r1, [r0]
/* set clock CLKDIVN*/
ldr r0, =0x4c000014
mov r1, #0x05; /* FCLK:HCLK:PCLK*/
str r1, [r0]
/* 如果HDIVN非0,CPU的总线模式应该从“fast bus mode”变为“asynchronous bus mode” */
mrc p15, 0, r1, c1, c0, 0 /* 读出控制寄存器 */
orr r1, r1, #0xc0000000 /* 设置为“asynchronous bus mode” */
mcr p15, 0, r1, c1, c0, 0 /* 写入控制寄存器 */
/* MPLLCON = S3C2440_MPLL_400MHZ,FCLK=PLL=400MHZ */
ldr r0, =0x4c000004
ldr r1, =(92<<12)|(1<<4)|(1<<0);
str r1, [r0]
部分.c文件
REG_GPHCON &= ~((DWORD)(3 << (2*3)) | (3 << (2*2)));
REG_GPHDAT &= ~((DWORD)(1 << 3) | (1 << 2));
REG_GPHUP &= ~((DWORD)(1 << 3) | (1 << 2));
REG_GPHCON |= ((DWORD)2 << (2*3)) | (2 << (2*2));
REG_GPHDAT |= ((DWORD)1 << 3) | (1 << 2);
REG_GPHUP |= ((DWORD)1 << 3) | (1 << 2);
REG_ULCON0 = 0x03;
REG_UCON0 = 0x05;
REG_UFCON0 = 0;
REG_UMCON0 = 0;
REG_UBRDIV0 = (PCLK_SPEED / (115200 * 16)) - 1;
//使能sub 收发中断
tempUINT32 &= ~((1<<SUBINT_LVL_RXD0)|(1<<SUBINT_LVL_TXD0));
s3c2440x_INT_REG_WRITE(s3c2440x_INT_CSR_INTSUBMSK,tempUINT32);