• Hello,
    I have trouble understanding UART communication on the FiPy.

    I use a FiPy 1.0, and Pysense but only for Vin, GND, TX0 and RX0 (simpler for me), the rest is done on a breadboard.

    Using ATOM text editor, and the following test code :

    uart = UART(1)
    uart.init(9600, bits=8, parity=None, stop=1, pins=('P3','P4')) 
    compteur = 0
    while True:
        input =
        if input is not None:
            compteur += 1
            print("INPUT : " + str(compteur))

    If I connect P3 and P4 with a jumper, I get :

    INPUT : 1
    INPUT : 2
    INPUT : 3

    in the ATOM editor log (as expected).

    However, when I try to read the output with a USB->RS232 converter, my COM debuging software (Docklight) receives (in hex)

    D6 B6 96 06

    And the FiPy reads a giant byte string composed of hundreds (600-700) of '\x00', even though nothing is sent.

    If I switch RX/TX then nothing happends, so that is not the issue. The FiPy is up to date.

    Do you have any ideas or recommandations for further testing ?

    PS : I can use this USB->RS232 converter and Docklight to succesfully chat with other devices such as industrial tiltmeters.

  • Solved : turns out I needed a USB<->TTL and not an USB<->RS232...

    I did not know about the TTL standard, as I did not study eletronics at all. Gotta learn the hard way !

  • So in the first post, I was trying reading data sent by the Pycom.
    I tried today to read data sent to the Pycom with the following code :

    uart=UART(1, 115200, bits=8, parity=None, stop=1, pins=('P3','P4'))
    while True:
            compteur += 1
            print("INPUT : " + str(compteur) + " (" + str(uart.any()) + ")")

    I have a sensor wich sends an ASCII string (18 bytes long) every second. I can read it with an USB->RS232 converter. However, On the pycom, I get the following "gibberish", every 4-5 seconds :

    INPUT : 9 (120)
    INPUT : 10 (120)

    The COM parameters are correct (115200, 8, None, 1). I connected the COM GND of my sensor to the GND of the Pycom.

    Does anyone has had a similar issue ? I can't find anything on the forum.

  • Thanks for noticing that, ATOM does not highlight "input" as a keyword...

    However, renaming dit not change the result.

  • You are naming it wrong.

    Have a look on the syntax highlighting of input. It is marked red, because input() is an internal function. Rename your variable to something safe like my_input and try it again.

Log in to reply

Pycom on Twitter