I’m trying to use the XIAO RP2040 with the DFPlayer Mini, but I can’t get UART to initialize properly.
My understanding is that for UART, pin 6 is the TX pin and pin 7 is the RX pin, and the UART ID is 0.
I stripped it down to just the UART code with nothing plugged in to the board, and I still get this error: ValueError: bad TX pin
What am I doing wrong?
import machine
tx_pin = machine.Pin(6, machine.Pin.OUT)
rx_pin = machine.Pin(7, machine.Pin.IN)
uart = machine.UART(0, 9600)
uart.init(9600, bits=8, parity=None, stop=1, tx=tx_pin, rx=rx_pin)