Two serial ports are used at the same time (uart1 and uart3), but they can only receive data from uart1. Is there any solution?
import time
import struct,math
from pyb import UART
print("Module:LORA")
uart = UART(3,115200, timeout = 1)
def Read_UART():
#print('read_uart')
Rx = uart.read()
print('Rx:',Rx)
time.sleep_ms(10)
if (Rx != None):
#print('ok')
print(Rx,type(Rx))
print('Module:遥控')
sbus = UART(1, 100000, timeout = 1) #串口初始化
def recv():
data = sbus.read()
print('data:',data)
def Remote_Ctr(): #遥控器控制
recv()
while(True):
Remote_Ctr() #遥控模块接收
Read_UART() #无线模块接收
experimental result:
Do you know the reason or the solution? Thank you very much.