-1

I'm trying to make a little connection between both my Raspberry pi 4 and my Pico.

Everything was ok until the pico suddenly stoped recieving what I'm sending from the Raspberrypi.

Expected Outcome I should receive on my Pico the following binary, or at least the letters in binary one-by-one, as:

b'h'
b'e'
b'l'
b'l'
b'o'

Actual Outcome

b'\x00'
b'\x00'
b'\x00'
b'\x00'
b'\x00'
b'\x00'
b'\x00'
b'\x00'
b'\x00'
b'\x00'
b'\x00'
b'\x00'
b'\x00'

Here is the Pico code where I should receive the binary that says b'hello' byte-by-byte:

from machine import UART, Pin
uart1 = UART(0, 115200, timeout=1, tx=Pin(0), rx=Pin(1))

while True:
    byte = uart1.read(1) # this reads one byte at atime
    if not byte:
        continue
    if uart1.any() > 0:
        print(byte)

Here is the Raspberrypi code where I send the binary that says b'hello':

import serial

ser = serial.Serial(
        '/dev/serial0',
        11520,
        timeout=1
    )

ser.write(b"hello") # this sends through the serial connection, in this case it's UART
7
  • Please EDIT your question and document the following commands. uart1.read(1) and ser.write(b"hello"). What are each of them meant to do according to the published documentation?
    – joan
    Aug 31, 2022 at 15:22
  • thanks for your comment, does this look better? @joan
    – mr.xed
    Aug 31, 2022 at 15:35
  • That does not look like what the library author would have written. Somewhere there should be a statement of what each function does.
    – joan
    Aug 31, 2022 at 15:42
  • @Meno-101 what is your specific question?
    – jsotola
    Aug 31, 2022 at 15:46
  • @Meno-101 did you verify the hardware?
    – jsotola
    Aug 31, 2022 at 15:47

1 Answer 1

1

The issue was with the Buadrate, I had it as 11520 while it should be 115200

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.