Problems while communicating with PPK2 using a serial port

 I am having problems communication with PPK2 using pySerial library. Below is an example of code causing the error. When I try to request metadata twice during the same connection PPK ignores the second one and returns nothing. Is this intended? Is there a workaround?

import serial


if __name__ == '__main__':
    ser = serial.Serial("COM4", baudrate=115200)
    ser.write(b"\x19") #\x0A\x0D
    r=ser.readline()
    print(r)
    while not str(r) == "b'END\\n'":
        r=ser.readline()
        print(r)
    time.sleep(1)

    ser.write(b"\x19")
    print("response")
    r = ser.readline()
    print(r)
    while not str(r) == "b'END\\n'":
        r = ser.readline()
        print(r)
    ser.close()

Parents Reply Children
  • Hi,

    Jakob123 said:
    The problem is I don't get a response. I would expect to get the metadata twice since I send two commands to retrive it, yet the app hangs at readline after "response" since ppk doesn't return anything.

    I have reproduced the issue which you reported. I have asked internally and got confirmation that it is not possible to get metadata twice in a row. 

    Best regards,
    Dejan

Related