RIIC2 通信一直在处于等待状态,ret = wait_tx_empty(channel); 但程序内没有进行其他的IIC通信,请问是哪里出了问题吗?

 

IIC程序是在led闪烁例程的基础上添加的,配置也都配置了。

 /* test for ACK */

if (DRV_FLAG_OFF_PRV_ == gs_riic_nack_flg[channel])
{
/* ACK received */
ret = DRV_SUCCESS;
}
else
{
/* NACK */

/* reset flag */
gs_riic_nack_flg[channel] = DRV_FLAG_OFF_PRV_;
ret = DRV_ERROR;
}

这一段是成功的,接下来的

if (DRV_SUCCESS == ret)
{
    /* ensure no current traffic on bus */
    ret = wait_tx_empty(channel);

    if (DRV_SUCCESS == ret)
    {
    /* clear tx empty flag prior to tx */
    gs_riic_transmit_empty_flg[channel] = DRV_FLAG_OFF_PRV_;

    /* Write data to wire */
    R_RIIC_WriteByte(channel, data);
    }

}

就一直卡在ret = wait_tx_empty(channel); 这一句的位置。