blackboy
Posts: 9
Joined: Tue Jul 26, 2016 1:28 pm
Contact: Website

(help) UART on raspberry

Tue Jul 26, 2016 1:46 pm

Hi every one,
i'm new member.
i am setting uart on raspberry, but it not work. (i am using newest version -raspian 2016-05-27).
I dont see "ttyAMA0" directory in my RPI =>
can you help me?
thank you verry much. (sorry about my english is not good.)

binaryhermit
Posts: 54
Joined: Sun Apr 13, 2014 1:26 am
Location: Lockport, Illinois
Contact: Website

Re: (help) UART on raspberry

Tue Jul 26, 2016 2:29 pm


User avatar
MarkHaysHarris777
Posts: 1820
Joined: Mon Mar 23, 2015 7:39 am
Location: Rochester, MN
Contact: Website

Re: (help) UART on raspberry

Tue Jul 26, 2016 2:44 pm

blackboy wrote: setting uart on raspberry, but it not work.
make sure to sudo apt-get update
make sure to sudo apt-get upgrade

Disable serial console in raspi-config; or at least remove the serial console item from /boot/cmdline.txt

Include the following two lines in /boot/config.txt:

core_freq = 250
enable_uart = 1

reboot.

You will have two serial devices: serial0 and serial1

serial0 will be a symbolic link to /dev/ttyS0
serial1 will be a symbolic link to /dev/ttyAMA0

marcus
marcus
:ugeek:

DirkS
Posts: 9876
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: (help) UART on raspberry

Wed Jul 27, 2016 11:18 pm

MarkHaysHarris777 wrote:You will have two serial devices: serial0 and serial1
Only if it's a Pi3B!

blackboy
Posts: 9
Joined: Tue Jul 26, 2016 1:28 pm
Contact: Website

Re: (help) UART on raspberry

Tue Aug 02, 2016 6:50 am

MarkHaysHarris777 wrote:
blackboy wrote: setting uart on raspberry, but it not work.
make sure to sudo apt-get update
core_freq = 250
enable_uart = 1
You will have two serial devices: serial0 and serial1
serial0 will be a symbolic link to /dev/ttyS0
serial1 will be a symbolic link to /dev/ttyAMA0

marcus
Thank you for your quick reply. i have a problems when i read uart data from icomsat v1.1 (module sim900) as shown below. Can you help me fix it?
Tks so much.
my code :

import serial
from serial import Serial
from time import sleep

ser = Serial("/dev/ttyAMA0", 9600, timeout=1)

while True:
data2 = ser.write('at')
data = ser.read(9999)
if len(data) > 0:
print data

sleep(0.5)

ser.close()
Attachments
Capture.PNG
Capture.PNG (2.51 KiB) Viewed 1963 times
Last edited by blackboy on Tue Aug 02, 2016 6:56 am, edited 1 time in total.

blackboy
Posts: 9
Joined: Tue Jul 26, 2016 1:28 pm
Contact: Website

Re: (help) UART on raspberry

Tue Aug 02, 2016 6:51 am

binaryhermit wrote:viewtopic.php?f=28&t=141195 perhaps?
Thank you for your quick reply. i have a problems when i read uart data from icomsat v1.1 (module sim900) as shown below. Can you help me fix it?
Tks so much.
Attachments
Capture.PNG
Capture.PNG (2.51 KiB) Viewed 1961 times

scotty101
Posts: 3649
Joined: Fri Jun 08, 2012 6:03 pm

Re: (help) UART on raspberry

Tue Aug 02, 2016 10:51 am

My guess would be a baud rate problem. The SIM900 seems to auto-sync baud rates but....

http://simcom.ee/documents/SIM900/SIM90 ... _V1.03.pdf

See section 4.
It is recommended to send "AT" until host device receives the "OK" response, echih means host device and SIM900 are correctly synchronised.
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

blackboy
Posts: 9
Joined: Tue Jul 26, 2016 1:28 pm
Contact: Website

Re: (help) UART on raspberry

Tue Aug 02, 2016 2:35 pm

scotty101 wrote:My guess would be a baud rate problem. The SIM900 seems to auto-sync baud rates but....

http://simcom.ee/documents/SIM900/SIM90 ... _V1.03.pdf

See section 4.
It is recommended to send "AT" until host device receives the "OK" response, echih means host device and SIM900 are correctly synchronised.
tks for your help. i tried it, when i called to module sim, it didn't appeared "Ring Ring Ring" , i saw x###### ... on the LCD instead. I dont know what heppend?
Do you know it?
Attachments
Capture.PNG
Capture.PNG (8.59 KiB) Viewed 1860 times

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: (help) UART on raspberry

Tue Aug 02, 2016 2:57 pm

are you sure "that thing" is returning text and not binary data that you have to decode?

User avatar
DougieLawson
Posts: 35560
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: (help) UART on raspberry

Tue Aug 02, 2016 5:07 pm

That looks like not the right protocol (is it sending 8N1) or not the right baud rate.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

blackboy
Posts: 9
Joined: Tue Jul 26, 2016 1:28 pm
Contact: Website

Re: (help) UART on raspberry

Wed Aug 03, 2016 2:17 am

Massi wrote:are you sure "that thing" is returning text and not binary data that you have to decode?
yes, I am. When i called, Raspberry Pi recived something, but i don't know what is it, it look like "RING RING RING".

blackboy
Posts: 9
Joined: Tue Jul 26, 2016 1:28 pm
Contact: Website

Re: (help) UART on raspberry

Wed Aug 03, 2016 2:53 am

DougieLawson wrote:That looks like not the right protocol (is it sending 8N1) or not the right baud rate.
tks for your help!
I set 9600 bauds on Raspberry Ri and I used the connection as figure.
Attachments
Untitled-compressed.jpg
Untitled-compressed.jpg (38.47 KiB) Viewed 1712 times

User avatar
karrika
Posts: 1057
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: (help) UART on raspberry

Wed Aug 03, 2016 3:30 am

blackboy wrote: while True:
data2 = ser.write('at')
data = ser.read(9999)
if len(data) > 0:
print data
Sending "at" is not the same as sending "AT". You need to send capital letters in order to let the board recognize the right baud rate.

blackboy
Posts: 9
Joined: Tue Jul 26, 2016 1:28 pm
Contact: Website

Re: (help) UART on raspberry

Wed Aug 03, 2016 4:30 am

karrika wrote:
blackboy wrote: while True:
data2 = ser.write('at')
data = ser.read(9999)
if len(data) > 0:
print data
That's right! but i don't read data from RX on raspberry pi. (x### as picture)


Sending "at" is not the same as sending "AT". You need to send capital letters in order to let the board recognize the right baud rate.

User avatar
karrika
Posts: 1057
Joined: Mon Oct 19, 2015 6:21 am
Location: Finland

Re: (help) UART on raspberry

Wed Aug 03, 2016 8:30 am

According to the specs you need to send AT AT AT AT with the desired baud rate until you get OK back. Then you should lock the baud rate by sending AT+IPR

I have no clue of what this invention does. But the docs are well written and worth reading.

Return to “Troubleshooting”