• UART Baud Rates

Hi there,

Following the UART script node example here all works well on the OAK-FFC-4P.

To make this useful in my pipeline I need a high baud rate. Trying to change the baud rate seems to not work. If changing to a non-standard baud the example errors out as expected in-line with the pySerial docs.

When trying to set a standard baud rate above 115200, like 230400, 460800, 576000 or 921600, the example runs implying these baud rates are supported by the platform, however, there is nothing on the data line. When the pipeline starts I see some activity on RX, however looking at the TX line on a logic analyser the TX just sits high at 1.8V.

Is a higher baud rate supported with UART? How can I configure this?

I assume I need to change the speed of a UART clock somewhere?

115200 Bauds: ser = serial.Serial("/dev/ttyS0", baudrate=115200)

230400 Bauds: ser = serial.Serial("/dev/ttyS0", baudrate=230400)

EDIT: Also tried with tty with no luck:

script.setScript("""
    import os, tty
    import time

    # time.sleep(50)

    msg = 'hello world from tty'
    node.warn(f'Sending message to UART: {msg}')

    # Open UART0 port, set raw and baudrate
    fd = os.open("/dev/ttyS0", os.O_RDWR | os.O_NOCTTY)
    tty.setraw(fd)
    mode = tty.tcgetattr(fd)
    mode[tty.ISPEED] = mode[tty.OSPEED] = tty.B460800
    tty.tcsetattr(fd, tty.TCSANOW, mode)

    while True:
        # Send hello message and print back received message
        os.write(fd, msg.encode())
        #node.warn(f'Read: {os.read(fd, 16)}')
        time.sleep(1)

""")
  • erik replied to this.
  • nem likes this.

    Hi nem ,
    Does anything below 115200 work (eg. 9600)? It might be that it's fixed in the firmware... Also note, as you can probably tell, that this feature isn't all that robust/supported, as there really aren't that many interested folks in UART (as of now).
    Thanks, Erik

    Thanks for the response @erik

    Yes slower baud rates do work fine. In my experience there would be a UART clock, possibly set @3Mhz? Wondering if there is a way to set this as part of the board configs? What do you think?

    Having UART (or SPI) is pretty important for a number of production use cases with the PoE or SoM modules I would think.

    Baud 9600:

    • erik replied to this.