I am receiving data from a GP20U7 GPS unit at 9600 (NMEA sentence bursts) that I need to forward to NMEA183 network at 4800. I thought that mismatch being not too big, and the NMEA data coming in bursts, internal UART buffers will be able to handle this and I can simply resend sentences using the following code:
#include <SoftwareSerial.h>
// Configure GPS
#define GPS_SerRX 2
#define GPS_SerTX 3
#define GPS_SerBDR 9600 // GPS baudrate
#define GPS_SerINV false // inverted output on or off
// Configure NMEA output
#define NMEA_SerRX 10
#define NMEA_SerTX 11
#define NMEA_SerBDR 4800 // NMEA output baudrate
#define NMEA_SerINV false // inverted output on or off
#define PTT_PIN 4
//##################################################################################
char gps_c;
SoftwareSerial GPS_Serial(GPS_SerRX, GPS_SerTX, GPS_SerINV);
SoftwareSerial NMEA_Serial(NMEA_SerRX, NMEA_SerTX, NMEA_SerINV);
void setup() {
pinMode(GPS_SerRX, INPUT); // define pin modes for TX and RX
pinMode(GPS_SerTX, OUTPUT);
pinMode(NMEA_SerRX, INPUT);
pinMode(NMEA_SerTX, OUTPUT);
pinMode(PTT_PIN, OUTPUT); // setup the NMEA PTT pin
digitalWrite(PTT_PIN, HIGH); // set the PTT to TX mode
Serial.begin(NMEA_SerBDR); // setup serial for debugging
delay(50);
NMEA_Serial.begin(NMEA_SerBDR); // setup the NMEA183 compatible serial
delay(50);
GPS_Serial.begin(GPS_SerBDR); // setup serial for GP20U7 GPS unit
}
void loop() {
if (GPS_Serial.available()) {
gps_c = GPS_Serial.read();
//Serial.print(gps_c);
//NMEA_Serial.print(gps_c);
Serial.write(gps_c);
NMEA_Serial.write(gps_c);
}
}
but the downstream NMEA receiver is not happy with the transmissions. Any hints?