查看: 580|回复: 7

Start kit V3板子输出UART2

[复制链接]

1

主题

2

帖子

42

积分

新手上路

Rank: 1

积分
42
发表于 2023-9-9 15:45:30 | 显示全部楼层 |阅读模式
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
回复

使用道具 举报

1

主题

2

帖子

42

积分

新手上路

Rank: 1

积分
42
 楼主| 发表于 2023-9-9 15:48:33 | 显示全部楼层

芯片型号:RH850F1KM S1 100pin。
回复

使用道具 举报

9

主题

95

帖子

9477

积分

论坛元老

Rank: 8Rank: 8

积分
9477
发表于 2023-9-17 13:30:02 | 显示全部楼层

啥板子
回复

使用道具 举报

16

主题

73

帖子

2636

积分

金牌会员

Rank: 6Rank: 6

积分
2636
发表于 2023-10-6 08:53:04 | 显示全部楼层
学习啦
回复

使用道具 举报

16

主题

73

帖子

2636

积分

金牌会员

Rank: 6Rank: 6

积分
2636
发表于 2023-10-6 11:12:00 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

用户排行榜

RA助手

主题: 116帖子:133精华:0

RA_Lance

主题: 92帖子:132精华:9

lugl

主题: 38帖子:126精华:0

xujiwei263

主题: 16帖子:73精华:0

books咦

主题: 11帖子:11精华:2

Juggernaut

主题: 9帖子:95精华:0
快速回复 返回顶部 返回列表