0

RP2040: Support for UART
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

RP2040: Support for UART

by Bruddy on Sun Feb 21, 2021 6:22 pm

Hi, I see on https://github.com/adafruit/circuitpython/pull/4224 that Support for UART on RP2040 seems to be working.
I downloaded the latest image for circuit python "adafruit-circuitpython-raspberry_pi_pico-en_US-20210221-2830984.uf2" but it seems not to have UART support in it yet.
As i am currently trying to do something that requires UART, is there anyway to try UART or it it necesary to wait until it is available in a CircuitPython release.
Bruddy

Bruddy
 
Posts: 9
Joined: Sat Feb 20, 2021 1:12 pm

Re: RP2040: Support for UART

by tannewt on Mon Feb 22, 2021 5:19 pm

There is a bit more work to do on that PR (adding more buffering). You can try artifacts from any PR by clicking "Commits", the most recent green checkmark and then "details" on any of the list entries. This will take you to a page like: https://github.com/adafruit/circuitpyth ... 1935501496 where you can click "Artifacts" in the top right corner and then select your board. It'll download a zip with all of the uf2s for every language.

The download from S3 only includes merged in PRs.

tannewt
 
Posts: 2189
Joined: Thu Oct 06, 2016 8:48 pm

Re: RP2040: Support for UART

by Bruddy on Mon Feb 22, 2021 5:28 pm

Thanks for that, I did not understand how the Github stuff worked. I follow it now. Thanks for such a clear explanation.

Bruddy
 
Posts: 9
Joined: Sat Feb 20, 2021 1:12 pm

Re: RP2040: Support for UART

by john_doe1337 on Sat Feb 27, 2021 1:25 pm

Hi Bruddy,
I am also looking for an UART solution. Did you find any?

john_doe1337
 
Posts: 6
Joined: Mon Mar 23, 2020 8:51 am

Re: RP2040: Support for UART

by Bruddy on Sat Feb 27, 2021 4:01 pm

I haven't been working on the Pico for a few days so I have made no progress. I hope to get back to it over the coming week.

Bruddy
 
Posts: 9
Joined: Sat Feb 20, 2021 1:12 pm

Re: RP2040: Support for UART

by john_doe1337 on Mon Mar 01, 2021 5:34 am

Got it running.

I downloaded the raspberry_pi_pico artefakt (uf2) from https://github.com/adafruit/circuitpyth ... /609203734 as tannewt described and with this code:
Code: Select all | TOGGLE FULL SIZE
"""CircuitPython Essentials UART Serial example"""
import board
import busio

uart = busio.UART(board.GP0, board.GP1, baudrate=9600, timeout=10)

while True:
    data = uart.read(32)  # read up to 32 bytes
    #print(data)  # this is a bytearray type

    if data is not None:

        # convert bytearray to string
        data_string = ''.join([chr(b) for b in data])
        print(data_string, end="")

john_doe1337
 
Posts: 6
Joined: Mon Mar 23, 2020 8:51 am

Re: RP2040: Support for UART

by tannewt on Mon Mar 01, 2021 5:11 pm

The UART PR has been merged in. It'll be in this week's beta and is in the "Absolute Newest" builds now.

tannewt
 
Posts: 2189
Joined: Thu Oct 06, 2016 8:48 pm

Re: RP2040: Support for UART

by Bruddy on Mon Mar 01, 2021 7:00 pm

Hi, I also have it running now using the latest image and the code you posted. I have Openplotter (which installs Opencpn) running on a Pi 4. I have two jumper wires about 150 mm long connecting the uart on the Pi to the uart on the Pico. I am using Opencpn to send NMEA to the uart on the Pi. I am only using RMB and RMC sentences as these are the only ones I need at the moment. I am running it at 38,400 and seem to have no errors.
By the way, running a Pimorini Fan Shim on the Pi uses the default uart pins. I need to run "sudo dtoverlay uart4" and GPIO 8 and 9 to get a working uart (/dev/tty/AMA1) on the Pi4. Adding "dtoverlay=uart4" to /boot/config.txt is not working for me as the fan shim software seems to disable it later in the boot process.

Bruddy
 
Posts: 9
Joined: Sat Feb 20, 2021 1:12 pm

Please be positive and constructive with your questions and comments.