在官方给的ISP程序中修改,我的LDROM只有2k,不修改硬件连接,
void UART0_IRQHandler(void){
if (inpw(&UART0->ISR/*COM_ISR*/) & 0x11) //RDA FIFO interrupt or RDA timeout interrupt
{
while(((inpw(&UART0->FSR/*COM_FSR*/) & (0x4000)) == 0) && (bufhead < 64))//RX fifo not empty
P53_DOUT=1;
uart_rcvbuf[bufhead++] = inpw(&UART0->RBR/*COM_RX*/);
}
if(bufhead == 64)
{
bUartDataReady = TRUE;
bufhead = 0;
P53_DOUT=0;
}
}
static __inline void UartInit(void)
{
outpw(&GCR->P0_MFP, 0x303);
GCR->IPRST_CTL2_BITS.UART_RST = 1;
GCR->IPRST_CTL2_BITS.UART_RST = 0;
CLK->APBCLK_BITS.UART_EN = 1;
/* Select UART clock source */
CLK->CLKSEL1_BITS.UART_S = 2;//0:12M; 2:22.1184M
/* Data format */
UART0->LCR_BITS.WLS = 3;
outpw(&UART0->FCR, 0x32);//14
UART0->TOR_BITS.TOIC = 0x40;
/* Configure the baud rate */
//BaudRateCalculator(SystemFrequency, 115200, &UART0->BAUD);
//22.1184M
*((__IO uint32_t *)&UART0->BAUD) = 0x2F00000A;//115200
//*((__IO uint32_t *)&UART0->BAUD) = 0x3F00017B;//0x16//57600
NVIC_SetPriority (UART0_IRQn, 2);
NVIC_EnableIRQ(UART0_IRQn);
//UART0->IER.RDA_IEN = 1;UART0->IER.TOC_IEN = 1;UART0->IER.TOC_EN = 1;//Enable Timeout Counter
outpw(&UART0->IER, 0x811);
}串口的初始化需要修改吗?
上面的中断里面5.3口连接的是RE/DE我可以直接置高置低吗? |