
Hardware include(s):
- Raspberry Pi Pico
- Adafruit Ultimate GPS breakout.
Software/IDE: Thonny 3.3.14 (Interpreter set to Pico) running on Pi400 (Raspberry Pi OS 64-bit)
Code: Select all
from machine import UART, Pin
# Connection to GPS
# UART_tx = Pin 8
# UART_rx = Pin 9
uart = UART(1, baudrate = 9600, tx=Pin(8), rx=Pin(9))
print(uart.read())
Code: Select all
>>>none
--------------------------------------------------------------------------------------------------------------------------
SOLUTION / RESOLUTION - what I learned in case anyone else is in a similar position (first time user of both pieces)
First - when using machine's Pin (from machine import Pin) make sure you use the GP# pin designation. I was using the sequential designation (i.e. 1,2,3,...40) instead. This was a no-go. So, for me using UART1 I used GP4 and GP5 pins and addressed them as Pin(4) and Pin(5). A clue will be a "bad Tx pin" error.
Second - Tx of one device connects to the Rx of the other device. Tx of Pico connects to Rx of GPS. Tx of GPS connects to Rx of Pico.
Third - Jumping Tx to Rx of the pico allows a loopback test (see thread below for code)
Fourth - Pay the UART#. UART0 and UART1 will need to be identified when you initialize your constructor. Failure to match up your UART# and your associated Tx/Rx pins will result in "bad Tx pin" errors.
- uart0 = UART(0, tx=(GP# for a UART0 Tx), rx=(GP# for a UARTO Rx), ... )
- uart1 = UART(1, tx=(GP# for a UART1 Tx), rx=(GP# for a UART1 Rx), ... )