Is there any way to use the sockets labeled UART0_RX, UART0_TX, UART1_RX, UART1_TX from MMBasic? If so, how?
from the manual: “COM1, COM2 Can be used for asynchronous serial I/O (UART0 and UART1 pins on the Pico datasheet).”
and also:
OPTION SERIAL CONSOLE
uartapin, uartbpin [,B]
Specify that the console be accessed via a hardware serial port (instead
of virtual serial over USB).
‘uartapin’ and ‘uartbpin’ can be any valid pair of rx and tx pins for either
COM1 or COM2. The order that they are specified is not important.
The speed defaults to 115200 baud but can be changed with OPTION
BAUDRATE. Adding the “B” parameter means output will go to "B"oth
the serial port and the USB.
Then after setting them up in options you could just call them as needed.
such as: OPEN comspec$ AS [#]fnbr
you could choose your own if you wanted to (within reason):
SETPIN rx, tx, COM1 Allocate the pins to be used for serial port COM1.
Valid pins are RX: GP1, GP13 or GP17
TX: GP0, GP12, GP16 or GP28
SETPIN rx, tx, COM2 Allocate the pins to be used for serial port COM2.
Valid pins are RX: GP5, GP9 or GP21
TX: GP4, GP8 or GP20
a quick grep of the manual will give you other ideas too
Are you talking about the lower half of the pins? Those belong to the motherboard and have to be accessed through the STM32 (I think?). I know the upper pins, GP4 and GP5 can be configured for serial communication pretty easily in PicoMite Basic. I am not sure how easy it would be use the lower pins.
You’re right about the pins labeled with GP but the lower ones (UART0, 1, etc.) aren’t Pico pins.
UART0_TX and UART0_RX are connected to the Pico’s GP0 and GP1 and can be used trivially. It’s only the UART1 and USB pins which aren’t (and the USB pins aren’t even connected to anything unless you change a dipswitch setting.)
Do you know what dipswitch has to be changed? Are UART1 pins connected to GP4 and 5 (COM2) after the change?
UART0 is always connected to GP0/GP1 on the Pico connector.
UART1 is always connected to the STM32 and can’t be used from the Pico at any time.
I was a little mistaken about the USB pins - they’re also permanently connected to the STM32. The dipswitch simply connects the USB-C socket to it as well.
I can’t seem to make UART0 work. When I connected to GP4 and GP5, I could use COM2 but when I try UART0_TX and UART0_RX, I can’t get anything through on COM1.
Update: I don’t know what happened but now I am getting a serial console on COM1 so now I can keep a console on COM1 and use COM2 for other data. I plan on connecting a serial printer to it.
Thank you for your help!
I spoke too soon.
When I use COM1 (UART0_TX and UART0_RX) I can type on the PicoCalc and it shows up in the terminal but nothing I type on the terminal shows up on the PicoCalc.
When I use COM2 (GP4 and GP5) communication works both ways.