|
Hi all:
我购买了Start kit V3的demon板,原有的UART0可以正常工作,我配置了UART2(port11_2,port11_3),目前无法正常工作,请大神帮忙看看。谢谢。整个软件包我已经上传了。
/*****************************************************************************
** Function: R_RLIN32_UartInit
** Description: Initialize the RLIN32 for UART usage.
** Parameter: None
** Return: None
******************************************************************************/
void R_RLIN32_UartInit(void)
{
/* RLIN30 is configured in UART mode with 9600 baud */
/* Disable RLIN */
RLN32LUOER=0x00u;
RLN32LCUC=0x00u;
/* LIN Mode Register/UART Mode Register (LMD) */
RLN32LMD=0x01u; /* UART mode, noise filter enabled */
/* LIN Break Field Configuration Register/UART Configuration Register1 */
RLN32LBFC=0x00u; /* UART 8-bit communication */
/* LSB first */
/* Stop Bit 1 bit */
/* Parity Disabled */
/* Without RX inversion */
/* Without TX inversion */
/* LIN / UART Error Detection Enable Register */
RLN32LEDE=0x00u; /* No error detection */
/* LIN Wake-up Baud Rate Selector register */
RLN32LWBR=0x50u; /* 6 samples per bit */
/* LIN Baud Rate Prescaler1/UART Baud Rate Prescaler */
RLN32LBRP01=0x02b5; /* Baudrate = PCLK / (((BRP value) + 1)*(number of samples per bit)) */
/* 40MHZ/((0x2b5+1)*6)= 9600 baud */
/* LIN / UART Control Register */
RLN32LCUC=0x01u; /* LIN reset mode is cancelled */
/* UART Operation Enable Register */
RLN32LUOER=0x03u; /* UART Transmission Operation Enable Bit */
/* UART Reception Operation Enable Bit */
}
/*****************************************************************************
** Function: R_RLIN32_UartSendString
** Description: Sends out a string via UART.
** Parameter: string to be send
** Return: None
******************************************************************************/
void R_RLIN32_UartSendString(char_t send_string[])
{
char i;
while((RLN32LST&16u)==16u)
{
/* Wait until RLIN transmission is finished */
}
// create a uart_buffer, to prevent data to be overwritten
for(i=0;i<64;i++)
{
uart_buffer[i] = send_string[i];
if(send_string[i]=='\0')
break;
}
g_pNextData = uart_buffer;
RLN32LUTDR = *g_pNextData;
}
/*****************************************************************************
** Function: R_RLIN32_GetStatus
** Description: Returns if RLIN32 is busy or ready.
** Parameter: None
** Return: RLIN32_busy
** RLIN32_ready
******************************************************************************/
uint8_t R_RLIN32_GetStatus(void)
{
if((RLN32LST&16u)==16u)
{
return RLIN_BUSY;
}
else /* If transmission bit is 0 (transmission ready) */
{
return RLIN_READY;
}
}
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
|