We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

UART ifinite output

  • Hello trying to learn working with UART. According this article https://docs.onion.io/omega2-docs/uart1.html i connected TX and RX pins. Form ubuntu open two terminals and open ssh session from both.
    run cat /dev/ttyS1 in one and echo "test" > /dev/ttyS1 in other. But i see my "test" message only for a moment of time cause my cat continue print empty strings to terminal. what im doing wrong? is some termination symbols should be sent from echo terminal?

    Also i redirect cat output to text file and found i receive multiple "test" messages.

    Update: pyserial working as expected.

    from serial import Serial
    from time import sleep
    ser = Serial('/dev/ttyS1', baudrate=115200, timeout=1)
    while True:
        data =  ser.readline()

  • Hi Vladimir,

    I am guessing you are programming in python with pyserial installed. It seems that the readline() would return a empty line, and therefore its printing nulls. This is because of the timeout being passed with 1. The print statement adds a newline at the end, so it will keep printing newlines. This is why you would see your text momentarily.

    You may want to use print(data, end="") if you don't want to add newlines at every print statement.

    You may want to check if there is data on the returned readline() before passing to print(data), as it would keep printing empty strings.

Log in to reply

Looks like your connection to Community was lost, please wait while we try to reconnect.