Using UART on XIAO nrf52840 in MicroPython


I’m trying to use the UART on a XIAO nrf52840 in MicroPython but I’m not getting any response.
So I’d like to troubleshoot the UART.

Say I use the most basic code:

from machine import UART

modem = UART(0, 115200)

How can I now check the defaults for bits/parity/stop/rx/tx ?

Also, is UART 0 reserved for the REPL? I’m using Thonny and I’m printing on USB, does that mean I can’t use UART 0?


Hi there.
So not being a Python guy, I do see this working, YMMV

import serial

ser = serial.Serial(
        port = '/dev/ttyUSB0',
        baudrate = 115200,
        timeout = 10,
        xonxoff = False
val = 0
command = ''
command = input("Enter command: ")
val = ser.write(command.encode(encoding = 'ascii', errors = 'strict'))
print("Waiting bytes: ", ser.in_waiting)
print("Bytes written: ", val)
in_data = ''
in_data = ser.read_until(b'}')

GL :slight_smile: PJ :v:

Yah, thanks for your reply but it’s micropython, not python.
This topic can be closed, sorry