Page 1 of 1

(help) UART on raspberry

Posted: Tue Jul 26, 2016 1:46 pm
by blackboy
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.)

Re: (help) UART on raspberry

Posted: Tue Jul 26, 2016 2:29 pm
by binaryhermit

Re: (help) UART on raspberry

Posted: Tue Jul 26, 2016 2:44 pm
by MarkHaysHarris777
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

Re: (help) UART on raspberry

Posted: Wed Jul 27, 2016 11:18 pm
by DirkS
MarkHaysHarris777 wrote:You will have two serial devices: serial0 and serial1
Only if it's a Pi3B!

Re: (help) UART on raspberry

Posted: Tue Aug 02, 2016 6:50 am
by blackboy
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()

Re: (help) UART on raspberry

Posted: Tue Aug 02, 2016 6:51 am
by blackboy
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.

Re: (help) UART on raspberry

Posted: Tue Aug 02, 2016 10:51 am
by scotty101
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.

Re: (help) UART on raspberry

Posted: Tue Aug 02, 2016 2:35 pm
by blackboy
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?

Re: (help) UART on raspberry

Posted: Tue Aug 02, 2016 2:57 pm
by Massi
are you sure "that thing" is returning text and not binary data that you have to decode?

Re: (help) UART on raspberry

Posted: Tue Aug 02, 2016 5:07 pm
by DougieLawson
That looks like not the right protocol (is it sending 8N1) or not the right baud rate.

Re: (help) UART on raspberry

Posted: Wed Aug 03, 2016 2:17 am
by blackboy
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".

Re: (help) UART on raspberry

Posted: Wed Aug 03, 2016 2:53 am
by blackboy
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.

Re: (help) UART on raspberry

Posted: Wed Aug 03, 2016 3:30 am
by karrika
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.

Re: (help) UART on raspberry

Posted: Wed Aug 03, 2016 4:30 am
by blackboy
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.

Re: (help) UART on raspberry

Posted: Wed Aug 03, 2016 8:30 am
by karrika
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.