0

I am also doing similar project with raspberry pi 4 (bullseye version) and neo 6m module. I have followed all the steps given in https://sparklers-the-makers.github.io/blog/robotics/use-neo-6m-module-with-raspberry-pi/ but I do not see any output when I do sudo cat /dev/serial0. It simply hangs, does not crash pi. Ctrl+C brings the unix prompt back, The blue light on the antenna is blinking as suggested by the article.

I don't know which other settings I am missing. Here is the gist of the tutorial:

  1. I am trying to read the GPS data by using Raspberry Pi 4 + Neo 6M GPS module
  2. I edited /boot/config.txt and added dtparam=spi=on dtoverlay=pi3-disable-bt core_freq=250 enable_uart=1 force_turbo=1 at the bottom of the file
  3. I created a backup of /boot/cmdline.txt and in the new cmdline.txt file, added dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
  4. After rebooting, sudo cat /dev/ttyAMA0 hangs. I checked that /dev/serial0 is linked to ttyAMA0. I also used raspi-config to disable login and lastly, I also performed sudo systemctl stop serial-getty@ttyAMA0.service sudo systemctl disable serial-getty@ttyAMA0.service but sudo cat /dev/ttyAMA0 or /dev/serial0 still hangs. Note that the blue light on the antenna is blinking which means the antenna is receiving data. Is it transmitting the data to pi? I don't know. Is there anyway to find it out other than sudo cat /dev/ttyAMA0?
1
  • This is a rather poor tutorial. It is old (pre Bullseye) and advises you to put things in config.txt which are obsolete. You should configure using raspi-config
    – Milliways
    Aug 23 at 4:41

1 Answer 1

0

I do not have a Neo 6 GPS, but on the RP 4B there are more UARTs to use instead of 0 and 1. I will provide a short example of how to use UART3 on the RP 4B which you may use to adapt to the GPS device.

#!/usr/bin/env python3

"""
EXAMPLE of UART communication on Raspberry Pi 4B using Python.

Multiple UARTs on Raspberry Pi 4B (CM4):
          TXD RXD CTS RTS     Board Pins
  uart0   14  15              8   10
  uart1   14  15              8   10
  uart2   0   1   2   3       27  28  (I2C0)
  uart3   4   5   6   7       7   29  (GPCLK0), (RTS 7 = SPI0-CE1)
  uart4   8   9   10  11      24  21  (SPI0)
  uart5   12  13  14  15      32  33  (gpio-fan)

Raspberry Pi 4B (CM4) setup:
  /boot/config.txt has dtoverlay=uart3, sudo reboot
  jumper from GPIO pin 4 to GPIO pin 5
  
https://www.electronicwings.com/raspberry-pi/raspberry-pi-uart-communication-using-python-and-c
https://pinout.xyz/pinout/uart
https://raspberrypi.stackexchange.com/questions/45570/how-do-i-make-serial-work-on-the-raspberry-pi3-pizerow-pi4-or-later-models/107780#107780
https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/configuration/uart.adoc
https://pyserial.readthedocs.io/en/latest/pyserial_api.html
"""

import serial
from time import sleep

ser = serial.Serial('/dev/ttyAMA1', 2500000, 8, 'N', 1)   # Open port
print(ser.get_settings)
x = 6
while x:
    ser.write(b'Hello out there!')          # Write byarray
    received_data = ser.read()              # Read serial port
    sleep(0.03)
    data_left = ser.inWaiting()             # Check for remaining byte
    received_data += ser.read(data_left)
    print(received_data.decode('utf-8'))   # Print received data
    x -= 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.