Hallo RN,
ich habe an meinem Raspberry einen GPS Sensor angebaut. Diesen habe ich so eingestellt das er alle 10 Sekunden ein NEMA Daten satz mit 9600 bps überträgt.
Nun habe ich das Problem das mein Raspberry die Daten Verpennt und nicht auswertet. Ich hatte den GPS Empfänger voher auf 1sec gestellt da lief es wunder bar. Ich habe auch überprüft ob es am GPS Empfänger liegt.
Aber er überträgt die Daten 100% richtig. Was kann ich ändern? Hier mein Script.

Code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math
import serial


# Important definitions:
PORT = "/dev/ttyAMA0"
BAUD_RATE = 9600

LOG_FILE = "gpsdaten.txt"

def read_nmea_record(ser):
    """Read a NMEA 0183 record from a serial connection."""
    cr = False
    lf = False
    record = '$'
    
    while ser.read() != b'$':
        pass
            
    while not (cr and lf):
        byte = ser.read()
        if byte == b'\r':
            cr = True
        elif byte == b'\n':
            lf = True
        
        record = record + chr(ord(byte))
            
    return record
        
        
def get_gps_data(ser):
    """Get actual GPS data as a dictionary."""
    try:
        record = ""
        while True:
            record = read_nmea_record(ser)
            print(record)
            fobj_out = open("/home/pi/uart_log.txt","a")
            fobj_out.write(record)
            fobj_out.close()
        
        
            if record.startswith('$GPGGA'):
                break
        
        tokens = record[7:-5].split(',')
    
        data = {}
    
        data['record_length'] = len(record)-2
        data['utc_time'] = tokens[0][0:2] + ":" + tokens[0][2:4] + ":" + tokens[0][4:6]
        data['latitude'] = float(tokens[1][0:2]) + float(tokens[1][2:]) / 60

        if tokens[2] == 'S':
            data['latitude_numeric'] = -data['latitude']
        else:
            data['latitude_numeric'] = data['latitude']
        
        data['latitude'] = "%.3f" % data['latitude'] + " " + tokens[2];

        data['longitude'] = float(tokens[3][0:3]) + float(tokens[3][3:]) / 60

        if tokens[4] == 'W':
            data['longitude_numeric'] = -data['longitude']
        else:
            data['longitude_numeric'] = data['longitude']
        
        data['longitude'] = "%.3f" % data['longitude'] + " " + tokens[4];

        data['gps_quality'] = int(tokens[5])
        data['satellite_count'] = int(tokens[6])
        data['horizontal_dilution'] = float(tokens[7])
        data['altitude'] = float(tokens[8])
        data['geoidal_separation'] = float(tokens[10])
    
        return data
        
    except:
        return None
        

    
    
def print_header():
    """Print the program header to stdout."""
    print("")
    print("|---------------------------------------------------------------------|")
    print("|---------------------------------------------------------------------|")
    print("| *****************************GPS*******************************|")
    print("|---------------------------------------------------------------------|")
    print("|---------------------------------------------------------------------|")
    

def print_gps_data(data):
    """Print the GPS data to stdout"""
    print("Laenge des Datensatzes:", data['record_length'], "Zeichen")
    print("Uhrzeit:", data['utc_time'])
    print("Breitengrad:", data['latitude'])
    print("Laengengrad:", data['longitude'])
    print("Hoehe ueber dem Meeresspiegel:", data['altitude'])
    print("GPS-Qualitaet:", data['gps_quality'])
    

def log_gps_data(data):
    """Append the GPS data to the log file."""
    log = open(LOG_FILE,"a+")
    log.write("___________________________________\n")
    log.write("Breitengrad: " + str(data['latitude']) + "\n")
    log.write("Laengengrad: " + str(data['longitude']) + "\n")
    log.write("Höhe: " + str(data['altitude']) + "\n")
    log.write("Zeit: " + str(data['utc_time']) + "\n")            
    log.write("Satelliten: " + "%.3f" % data['satellite_count'] + "\n")            
    log.write("Qualitaet: " + str(data['gps_quality']) + "\n")            
    log.close();
    




# UART oeffnen
UART = serial.Serial(PORT, BAUD_RATE)

print_header()

while True:

    data = get_gps_data(uart)
    
    if data:
        
        print_gps_data(data)
        log_gps_data(data)

14:47:54 $GPRMC,144754.00,A,5200.23778,N,01142.97998,E,1.06 2,227.70,190114,,,A*6E
14:47:54 $GPVTG,227.70,T,,M,1.062,N,1.967,K,A*31
14:47:54 $GPGGA,144754.00,5200.23778,N,01142.97998,E,1,09,1 .29,81.2,M,44.6,M,,*6B
14:47:54 $GPGSA,A,3,09,13,02,10,04,08,07,16,23,,,,2.12,1.29 ,1.68*03
14:47:54 $GPGSV,3,1,12,02,37,266,36,04,24,211,30,05,28,303, ,07,66,161,27*71
14:47:54 $GPGSV,3,2,12,08,37,192,24,09,33,203,30,10,79,217, 32,13,57,071,08*74
14:47:54 $GPGSV,3,3,12,16,22,048,16,23,25,081,25,26,01,259, ,29,05,325,*7F
14:47:54 $GPGLL,5200.23778,N,01142.97998,E,144754.00,A,A*60
14:48:04 $GPRMC,144804.00,A,5200.23680,N,01142.97782,E,0.44 3,227.70,190114,,,A*61
14:48:04 $GPVTG,227.70,T,,M,0.443,N,0.821,K,A*35
14:48:04 $GPGGA,144804.00,5200.23680,N,01142.97782,E,1,07,1 .49,86.0,M,44.6,M,,*6F
14:48:04 $GPGSA,A,3,09,02,10,04,08,07,23,,,,,,2.36,1.49,1.8 3*03
14:48:04 $GPGSV,3,1,12,02,37,266,35,04,24,211,26,05,28,303, ,07,66,161,26*74
14:48:04 $GPGSV,3,2,12,08,37,192,28,09,33,203,31,10,79,217, 33,13,57,071,*70
14:48:04 $GPGSV,3,3,12,16,22,048,10,23,25,081,26,26,01,259, ,29,05,325,*7A
14:48:04 $GPGLL,5200.23680,N,01142.97782,E,144804.00,A,A*69