Micropython UART doesn't work on Picos RP2040
Micropython UART doesn't work on Picos RP2040
Hello,
I'm an absolutely beginner in Micropython Programming.
I don't know how I can ask for help.
I have installed the latest firmware, by enabling UART support and I have taken the example from
the Raspberry Pi Pico Python SDK.
It doesn't work.
After this I tried this code:
from machine import UART, Pin
import time
uart1 = UART(1, 9600, parity=None, stop = 1, bits = 8, tx=Pin(8), rx=Pin(9),timeout=10)
uart0 = UART(0, 9600, parity=None, stop = 1, bits = 8, tx=Pin(0), rx=Pin(1),timeout=10)
txData = b'hello world\n\r'
uart1.write(txData)
time.sleep(0.1)
rxData = bytes()
while uart0.any() > 0:
rxData += uart0.read(1)
print(rxData.decode('utf-8'))
It doesn't work.
I'm an absolutely beginner in Micropython Programming.
I don't know how I can ask for help.
I have installed the latest firmware, by enabling UART support and I have taken the example from
the Raspberry Pi Pico Python SDK.
It doesn't work.
After this I tried this code:
from machine import UART, Pin
import time
uart1 = UART(1, 9600, parity=None, stop = 1, bits = 8, tx=Pin(8), rx=Pin(9),timeout=10)
uart0 = UART(0, 9600, parity=None, stop = 1, bits = 8, tx=Pin(0), rx=Pin(1),timeout=10)
txData = b'hello world\n\r'
uart1.write(txData)
time.sleep(0.1)
rxData = bytes()
while uart0.any() > 0:
rxData += uart0.read(1)
print(rxData.decode('utf-8'))
It doesn't work.
Re: Micropython UART doesn't work on Picos RP2040
Some info is missing: How did you connect both UART-s?
Re: Micropython UART doesn't work on Picos RP2040
... is a bit too less for a description of your problem.
What SHOULD it do (what do you expect) ? What DOES it ?
A few hours of debugging might save you from minutes of reading the documentation!
My repositories: https://github.com/karfas
My repositories: https://github.com/karfas
Re: Micropython UART doesn't work on Picos RP2040
Works fine here, after connecting GPIO1 (Pin 1) to GPIO 8 (PIN 12). GPIO0 (Pin 1) to GPIO9 (Pin 12) is required to communication the other way around.
Re: Micropython UART doesn't work on Picos RP2040
You wrote:
Works fine here, after connecting GPIO1 (Pin 1) to GPIO 8 (PIN 12).
GPIO0 (Pin 1) to GPIO9 (Pin 12) is required to communication the other way around.
My Question:
Why is GPIO1 AND GPIO0 assigned to PIN 1?
Works fine here, after connecting GPIO1 (Pin 1) to GPIO 8 (PIN 12).
GPIO0 (Pin 1) to GPIO9 (Pin 12) is required to communication the other way around.
My Question:
Why is GPIO1 AND GPIO0 assigned to PIN 1?
Re: Micropython UART doesn't work on Picos RP2040
Typo: GPIO1 (Pin 2) to GPIO 8 (PIN 12). For this test you have to connect TX to RX
Re: Micropython UART doesn't work on Picos RP2040
You wrote in my summary of understanding by merging your 2 replies:
GPIO0 (Pin 1) to GPIO9 (Pin 12)
GPIO1 (Pin 2) to GPIO8 (PIN 12)
Is this a Typo too?
GPIO0 (Pin 1) to GPIO9 (Pin 12)
GPIO1 (Pin 2) to GPIO8 (PIN 12)
Is this a Typo too?
Re: Micropython UART doesn't work on Picos RP2040
Right: GPIO8 is Pin 11. RX to TX. I wired it right, but wrote it wrong.
Re: Micropython UART doesn't work on Picos RP2040
Source:
from machine import UART, Pin
import time
uart1 = UART(1, 9600, parity=None, stop = 1, bits = 8, tx=Pin(8), rx=Pin(9),timeout=10)
uart0 = UART(0, 9600, parity=None, stop = 1, bits = 8, tx=Pin(0), rx=Pin(1),timeout=10)
txData = b'hello world\n\r'
uart1.write(txData)
time.sleep(0.1)
rxData = bytes()
while uart0.any() > 0:
rxData += uart0.read(1)
print(rxData.decode('utf-8'))
Response:
MicroPython v1.18-5-g037b2c72a-dirty on 2022-01-19; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
It doesn't work, no response at all.
from machine import UART, Pin
import time
uart1 = UART(1, 9600, parity=None, stop = 1, bits = 8, tx=Pin(8), rx=Pin(9),timeout=10)
uart0 = UART(0, 9600, parity=None, stop = 1, bits = 8, tx=Pin(0), rx=Pin(1),timeout=10)
txData = b'hello world\n\r'
uart1.write(txData)
time.sleep(0.1)
rxData = bytes()
while uart0.any() > 0:
rxData += uart0.read(1)
print(rxData.decode('utf-8'))
Response:
MicroPython v1.18-5-g037b2c72a-dirty on 2022-01-19; Raspberry Pi Pico with RP2040
Type "help()" for more information.
>>> %Run -c $EDITOR_CONTENT
It doesn't work, no response at all.
Re: Micropython UART doesn't work on Picos RP2040
That's what I get, NOT using a fancy IDE, but just REPL in a terminal emulator (picocom):
And this is your code, which I use:
Code: Select all
h
he
hel
hell
hello
hello
hello w
hello wo
hello wor
hello worl
hello world
hello world
hello world
Code: Select all
from machine import UART, Pin
import time
uart1 = UART(1, 9600, parity=None, stop = 1, bits = 8, tx=Pin(8), rx=Pin(9),timeout=10)
uart0 = UART(0, 9600, parity=None, stop = 1, bits = 8, tx=Pin(0), rx=Pin(1),timeout=10)
txData = b'hello world\n\r'
uart1.write(txData)
time.sleep(0.1)
rxData = bytes()
while uart0.any() > 0:
rxData += uart0.read(1)
print(rxData.decode('utf-8'))