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()           
    
  • 2
    Why wheezy? The better choice is the current jessie unless you actually need wheezy. You appear to be following old instructions re the serial link in the Pi3. – joan Apr 20 '17 at 12:40
  • i tried jessie too but still no success – Dipesh Sharma Apr 20 '17 at 12:41
  • 1
    @DipeshSharma Just delete the "/dev/ttyAMA0" and write "/dev/ttyS0". Simple as that... – Fusseldieb Apr 20 '17 at 12:50
  • 1
    @fusseldieb:- Thanks the /dev/ttyS0 solved the issue, but one thing i didnt understand i am able to see data on hercules(virtual terminal for usb to ttl ) but i was not able to visualise data on minicom – Dipesh Sharma Apr 20 '17 at 13:21
  • 1
    @Fusseldieb,: The issue regarding the uart is solved. Thanks a lot guys for the support. The issue was with wire jumper connecting. Now i am able to see the data on minicom too. – Dipesh Sharma Apr 21 '17 at 9:21
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() 
|improve this answer|||||

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.