0

I'm just trying to setup a communication between a development board and my Ubuntu system through the serial port.

I'm using the pyserial package with python3.9.

if __name__ == '__main__':
    ser = None
    try:
        ser = serial.Serial('/dev/ttyUSB2', 115200, timeout=5)
        print('Successfully connected!')
    except ConnectionError as msg:
        print(msg)

    cmd = b"AT\r\n"
    #cmd = "AT"
    #ser.write(cmd.encode)
    #ser.write(cmd.encode('utf-8')
    
    ser.write(cmd)
    resp = ser.readline()
    print(resp)
    ser.close()

I've already tried to send that command 'ATE0' to turn off the ECHO, but it doesn't work.

Please, if you have any idea about this, I would appreciate the help.

Iulian98
  • 31
  • 3
  • Are you sure your board is working and it doesnt have hardware problem? If it is ok did you see [this question](https://stackoverflow.com/questions/68895489/python-serial-read) try to add sleep between write and read – Nikolay Tsvetanov Apr 14 '22 at 12:26
  • 1
    Echo can be performed by the remote unit and/or locally. Since Linux is the underlying OS, you need to be aware of the termios API for serial terminals. See https://stackoverflow.com/questions/41368245/reading-from-serial-port-always-returns-what-was-written You can use the **stty** command to inspect (and change) the termios settings. – sawdust Apr 14 '22 at 17:55

0 Answers0