Page 1 of 1

problem with using UART on raspberry pi ZERO

Posted: Mon Apr 24, 2017 9:23 am
by profeciak
Hi all,
as in the topic I can't get my UART port to work. I've disable the serial using raspi-config. Now when i type ls/dev there is no ttyAMA0, so when I try to use for example cat </dev/ttyAMA0 there is a message that there is no such file. I'm trying to connect GPS to my Pi via UART port. I've made that via USB so I don't think, that there is a software problem or something. I've connected to the proper pins on my board. Could anyone help me? Also when I did $ sudo killall gpsd
$ sudo gpsd /dev/ttyAMA0 -F /var/run/gpsd.sock as suggested in some posts, and typed one more time sudo killall gpsd it says that no process found. So it means that the still UART port doesn't work

Re: problem with using UART on raspberry pi ZERO

Posted: Mon Apr 24, 2017 2:15 pm
by DirkS
Check that you have a line

Code: Select all

enable_uart=1
in /boot/config.txt

Re: problem with using UART on raspberry pi ZERO

Posted: Mon Apr 24, 2017 2:37 pm
by bensimmo
You answer disable to the console and enable to the serial from raspi-config.
Then reboot.
You then access it as serial0 not ttyAMA0 to keep it uni eraal (though on a zero it should work, but a ZeroW it would not).

Re: problem with using UART on raspberry pi ZERO

Posted: Tue Apr 25, 2017 6:38 am
by profeciak
Thanks for replies. Yes I have enable_uart = 1 in the config.txt. Moreover I can see the output from gps using cat /dev/ttyAMA0, but there is still a problem while I try to use gpsmon or cgps. When I try to use sudo gpsmon /dev/ttyAMA0 I got "gpsmon: ERROR: /dev/ttyAMA0 already opened by another process" so it looks like something from the system is constantly using this uart port.

Re: problem with using UART on raspberry pi ZERO

Posted: Tue Apr 25, 2017 7:58 am
by bensimmo
Probably the console...
Run through the raspi-config settings again.
Turn console off and serial on when it asks.
Reboot.
(I know as i went through it and another chap on here followed in the past few days while working through it)

You shouldn't need sudo and shouldn't need to point gpsmon where to look.

Just gpsmon On its own should work, find the port (serial0, set the baud rate (9600) and even flip to ublox/whatever chipset driver)

Re: problem with using UART on raspberry pi ZERO

Posted: Tue Apr 25, 2017 8:00 am
by bensimmo
bensimmo wrote:Probably the console...
Run through the raspi-config settings again.
Turn console off and serial on when it asks.
Reboot.
(I know as i went through it and another chap on here followed in the past few days while working through it)

You shouldn't need sudo and shouldn't need to point gpsmon where to look.

Just gpsmon On its own should work, find the port (serial0, set the baud rate (9600) and even flip to ublox/whatever chipset driver)

P.S. Just noticed, what has USB you mention got to do with this?

Re: problem with using UART on raspberry pi ZERO

Posted: Tue Apr 25, 2017 8:04 am
by profeciak
Before the fun with the UART port, I got it working on USB, then decided to change it to work on UART. Also how to turn console off? I'm working using desktop autologin boot option.

Re: problem with using UART on raspberry pi ZERO

Posted: Tue Apr 25, 2017 8:37 am
by davidcoton
What is the voltage on your GPS serial connection? It (and your USB adapter) may use true RS232 positive and negative voltages (commonly +/- 5V, but anywhere in the +/- 3-24V range). Your Pi's console port is 3V3 logic. Connecting a source of a different voltage can damage the port, and the GPS probably won't recognise signals from the Pi. You probably need a level converter to make it work, if the Pi's port has survived this far.

Re: problem with using UART on raspberry pi ZERO

Posted: Tue Apr 25, 2017 8:53 am
by profeciak
3.3 V I checked that in the datasheet of the GPS module before making connections

Re: problem with using UART on raspberry pi ZERO

Posted: Tue Apr 25, 2017 9:55 am
by bensimmo
Open a terminal/command line
Type
sudo raspi-config

Select 5 Interfacing Options
P6 Serial Options

Select NO to login shell over serial...
Select YES to serial port

DO NOT use the Pixel - Preferences - RaspberryPi Configuration for this, it does not do it properly.

What GPS module are you using?
Either way, since you can see the data off it, it working.

Re: problem with using UART on raspberry pi ZERO

Posted: Wed Apr 26, 2017 6:26 am
by profeciak
Thanks bensimmo for reply. So I had the console turned off and the serial port enabled all the time. Also I did that from raspi-config. I'm using GPS module from pixhawk - NEO 6M from what I can see. Unfortunately after I upgraded my Jessie to the latest release (before I had only one option to Disable/Enable whole Serial Port, now there are two) I cannot see the result of gps working using even cat command. And of course I set the baud rate of serial0 port to 9600. Also now I made some test using sudo gpsd -N -D3 -F /var/run/gpsd.sock /dev/serial0 and in the second terminal I used cgps -s. This is what I got:
gpsd:CLIENT: info about version, release en watch
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: /dev/serial0: device activation failed.
gpsd:CLIENT: info about devices, it has path /dev/serial0
again errors as above

Re: problem with using UART on raspberry pi ZERO

Posted: Mon May 08, 2017 6:31 am
by profeciak
Also when I use sudo cat /dev/serial0 after some time it stops working sometimes after few seconds, sometimes after few minutes. I don't know what can be the cause of this.