3

I have a problem regarding the uart not working at all, following are the steps as done from my side.

  1. updated and upgraded the raspberry pi,initially i installed raspbian wheezy to sd card and i am running pi over ssh.
  2. in config.txt added

    enable_uart=1
    core_freq=250
    force_turbo=1
    dtoverlay=pi3-disable-bt
    
  3. in cmdline.txt removed the line related to ttyAMA0, the remaining command is as follows:

    dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p rootfstype=ext4 elevator=deadline rootwait
    
  4. i opened the minicom and tried to see if data appears, but i was not able to visualise any kind of data. Following is the python code:

    import time
    import serial
    print "Starting program"
    ser = serial.Serial('/dev/ttyAMA0', baudrate=9600,
                        parity=serial.PARITY_NONE,
                        stopbits=serial.STOPBITS_ONE,
                        bytesize=serial.EIGHTBITS
                        )
    time.sleep(1)
    while 1:
        ser.write('Success')
        print 'Data Echo Mode Enabled'
        ser.close()           
    
goldilocks
  • 56,430
  • 17
  • 109
  • 217

1 Answers1

1

As detailed in the comments, the solution is to replace "/dev/ttyAMA0" with "/dev/ttyS0" in the code, giving:

import time
import serial
print "Starting program"
ser = serial.Serial('/dev/ttyS0', baudrate=9600,
                    parity=serial.PARITY_NONE,
                    stopbits=serial.STOPBITS_ONE,
                    bytesize=serial.EIGHTBITS
                    )
time.sleep(1)
while 1:
    ser.write('Success')
    print 'Data Echo Mode Enabled'
    ser.close()