UART RTS/CTS are working correctly?



  • Dear all,

    Firmware version: 1.20.0.rc13

    Following UART pycom documentation: https://docs.pycom.io/firmwareapi/pycom/machine/uart/
    It is reported that
    "pins is a 4 or 2 item list indicating the TXD, RXD, RTS and CTS pins (in that order). Any of the pins can be None if one wants the UART to operate with limited functionality. If the RTS pin is given the the RX pin must be given as well. The same applies to CTS. When no pins are given, then the default set of TXD (P1) and RXD (P0) pins is taken, and hardware flow control will be disabled. If pins=None, no pin assignment will be made"

    However, following also the example given on the docs:

    from machine import UART
    
    # this uses the UART_1 non-default pins for TXD, RXD, RTS and CTS (``P20``, ``P21``, ``P22``and ``P23``)
    uart = UART(1, baudrate=9600, pins=('P20', 'P21', 'P22', 'P23'))
    uart.write('hello')
    

    I can't comunicate because RTS never raises.
    If I program a "hard-coded" RTS, like

    RTS = Pin('G16', mode=Pin.OUT, value=0, pull=Pin.PULL_DOWN)
    

    and just switch ON-OFF this RTS signal before UART TX, now it works!!

    RTS.value(1)
    uart.write('hello')
    time.sleep(0.1)
    RTS.value(0)
    

    Please notice that I have to give some time with th time.sleep to allow the write process to be completed. This is what I try to avoid making use of the supposely embedded RTS of the UART library, since it waits to all data to be sent.

    From previous topics, some users also claims that UART is not fully developed on the firmware, and it might be abug the implementation of the RTS/CTS.

    Has anyone checked that it works as expected?

    Thanks and BR
    Alvaro


Log in to reply
 

Pycom on Twitter