Using the UART


11 posts
by kghunt » Fri Jul 13, 2012 12:04 pm
How do I use the Uart serial port do I have to disable console output to it to be able to use it in python?
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by Gert van Loo » Fri Jul 13, 2012 12:37 pm
Yes, and you must disable the getty process plus it's respawn which I think is still in most distributions.
User avatar
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2081
Joined: Tue Aug 02, 2011 7:27 am
by kghunt » Fri Jul 13, 2012 12:45 pm
I have removed the references to /dev/ttyama0 from /boot/cmdline.txt and /etc/innittab. Then rebooted but I still cant get the uart working.

Should the uart pins be outputting 3v all the time?
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by kghunt » Fri Jul 13, 2012 1:15 pm
Just had a thought. I am powering the reader I am connecting from the 3v3 the datasheet says typical draw is 45 mah but maximum is 120. Im wondering if this is the reason I cannot get it to work. How can I drop the 5v supply to 3.3 so I can power the reader from this? I can power the reader from 5v but then the serial pins output 5v too. I assume this would not be good?
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by Gert van Loo » Fri Jul 13, 2012 5:04 pm
I have no idea what you are talking about.
What is this reader you are talking about?
What have you connected that you conclude it does not work?
The UART is3V3 and 3V3 only. Always.
User avatar
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2081
Joined: Tue Aug 02, 2011 7:27 am
by kghunt » Fri Jul 13, 2012 8:34 pm
The device I am connecting is a ttl uart 3.3v Mifare reader. I have an rs232 version of the same reader and that works fine on a USB serial converter. I wanted to get rid of the converter so got the ttl version but I cannot get any input from /dev/ttyAMA0
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by Grumpy Mike » Sun Jul 15, 2012 7:52 pm
How can I drop the 5v supply to 3.3 so I can power the reader from this?

Use a 3v3 regulator from the 5V line, you need caps on the input and output as well.

I am powering the reader I am connecting from the 3v3

Can you run the reader from such a low voltage? If you can it is most unusual.

so got the ttl version

TTL is 5V not 3v3 are you sure you are not trying to drive 5V into the Pi?

Should the uart pins be outputting 3v all the time?

All the time when not outputting data the signal level should be high (3v3)
User avatar
Posts: 784
Joined: Sat Sep 10, 2011 7:49 pm
Location: Manchester (England England)
by kghunt » Sun Jul 15, 2012 8:04 pm
The reader is definitely rated to work from 3 to 5 volts and the voltage you put in has a direct relation to the voltage coming out ( I checked with a meter).

I have been very careful not to push 5 volts into the pi.

The other reader I have is also rated from 3 to 5 volts but that is rs232 not ttl and the output voltage is 7 volts on that one and does not change if I use a different supply.
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by kghunt » Sun Jul 15, 2012 8:19 pm
I am starting to wonder now if I haven't at some point earlier on damaged my uart interface by accident?

I have never tried to use it until now. I have a USB ttl adapter coming soon so I should be able to see if my pi is outputting anything and also if my reader is outputting anything too.

There is only one uart on the pi isn't there?
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by kghunt » Mon Jul 16, 2012 10:55 am
I created a loopback connection and that worked fine so it must be something to do with the serial settings on the reader or the reader is faulty.
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am
by kghunt » Mon Jul 16, 2012 11:34 am
Also both the tx and rx pins on the pi measuer +3.3v all the time but the reader only measures 0.1v on rx and 3.3v on tx.

Also I tested the reader on a friends Pi with the same results. So maybe this reader is faulty or I have the settings wrong somewhere.

this is the datasheet

http://www.ehuoyan.com/download/module/ ... CTGV33.pdf
Posts: 360
Joined: Sun Mar 04, 2012 9:28 am