K210与ESP32串口通信
K210共有三个硬件串口(用一个就够了),可以通过交换矩阵连接到任一IO。在Maixduino中可用引脚是D2-D13(IO21\IO22\IO23\IO24\IO32\IO15\\IO14\IO13\IO12\IO11\IO10\IO3)。
代码:
from machine import UART
from board import board_info
from fpioa_manager import fm
# maixduino board_info PIN10/PIN11/PIN12/PIN13 or other hardware IO 10/11/4/3
fm.register(board_info.PIN10, fm.fpioa.UART1_TX, force=True)
fm.register(board_info.PIN11, fm.fpioa.UART1_RX, force=True)
uart_A = UART(UART.UART1, 115200, 8, 0, 0, timeout=1000, read_buf_len=4096)
while 1:
write_str = 'hello world\n'
uart_A.write(write_str)
uart_A.deinit()
del uart_A
将10,11号引脚连到CH340模块上

即可看到输出
