0

I'm newbie on Raspberry Pi.I have installed serial port using following conmand on raspian l os.

sudo apt-get install python-serial

I'm trying to access serial port communication on Raspberry Pi 3. I have created script using python. When I run the script, I got following error.

Error: serial device '/dev/ttyAMA0' does not exist

But When I used /dev/ttyS0, it's working fine. Why?

My script here.

import serial

port = serial.Serial("/dev/ttyAMA0", baudrate=9600)

while True:
    port.write("Hello world")
    rcv = port.read(10)
    print rcv
1

You have NOT "installed serial port", although you may have installed python-serial

I don't know why you would get serial device '/dev/ttyAMA0' does not exist, because it SHOULD, although it is connected to Bluetooth, unless you have changed something.

In contrast /dev/ttyS0 SHOULD not exist, because it is disabled by default, again unless you have changed something. (It is possible installing python-serial may have done this.)

The only conclusion is that you have executed some other commands, you are not telling us about.

See How-do-i-make-serial-work-on-the-raspberry-pi3 for an explanation.

PS as outlined in the above you now use /dev/serial0, which should work on all models.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.