ret_uart2 = rt_device_open(serial_u2, RT_DEVICE_OFLAG_RDWR | RT_DEVICE_FLAG_INT_RX);
if(ret_uart2 < 0)
{
LOG_E("can't open uart2\r\n");
return RT_ERROR;
}
rt_device_set_rx_indicate(serial_u2, RxCallBackUart2);
ret_uart2rxsem = rt_sem_init(&uart2rx_sem, "rx_sem", 0, RT_IPC_FLAG_PRIO);
if(ret_uart2rxsem < 0)
{
LOG_E("ret_uart2rxsem create failed!\r\n");
return RT_ERROR;
}
rt_device_write(serial_u2, 0, str, sizeof(str));
static rt_err_t RxCallBackUart2(rt_device_t dev, rt_size_t size) //接受回调函数
{
LOG_D("JION RxCallBackUart2\r\n");
rt_sem_release(&uart2rx_sem);
return RT_EOK;
}
没有485,我只打开串口了
有没有找到原因,我也是一样的。四个串口 三个都能接受发送,只有一个串口只能发送不能接收