Example12_UseUart - ZED F9P communication issues with Arduino Mega using UART 1

Hi everyone,

I am doing this post rearding the SparkFun_u-blox_GNSS_Arduino_Library example code “Example12_UseUart.ino”, for reading lat and long via UBX binary commands using UART 38400 baud - free from I2C.

https://github.com/sparkfun/SparkFun_u- … seUart.ino

I currently encounter issues while implementing this code. I’m using the ZED-F9P on a board + Arduino Mega 2560 as CPU, and I can’t establish any connection between devices while using this code / SparkFun_u-blox_GNSS_Arduino_Library.h.

I have been trying to debug this for days but can’t make it work… Would you have any ideas where the issue comes from and how could I fix it ? Have you heard of any similar experiences in the past?

Below some more information:

My wiring:

Arduino 5V → Vin F9P board

Arduino GND → GND F9P board

Arduino IOREF → IOREF F9P board

Arduino RX (PIN 19) → TX F9P board (Serial1)

Arduino TX (PIN 18) → RX F9P board (Serial1)

U-Center configuration:

I did set-up in Message view → CFG → PORTS: Target UART1 / UBX messages as protocol in / UBX NMEA RTCM 3 messages as protocol out / baud rate 38400

Arduino program 1: No issues

While using this basic program I do well receiving NMEA messages and can read them in the Arduino serial monitor so the communication is working.

void setup() {
  Serial.begin(9600);  // Communication IDE Arduino
  Serial1.begin(38400); // Serial1 communication with GNSS module
}
void loop() {
  while (Serial1.available()) {
    char c = Serial1.read()
    Serial.write(c); //Get NMEA messages on IDE
  }
  delay(3000);
}

Arduino program 2: Issues

Then when I want to implement the Example12_UseUart.ino, with modifications so I use Serial1 with RX pin = 19 and TX pin = 18, the code gets stuck in the synchronization loop to check if it runs well at 38400 baud, so I’m not able to read anything further.

Many thanks for your help!

Lucas

Try to edit like this:

void setup() {
  Serial.begin(9600); // For communication with the serial monitor
  Serial1.begin(38400); // For communication with the ZED-F9P
  
  // Set the debug port to Serial for logging
  myGNSS.enableDebugging(Serial);

  // Initialize the GNSS module on Serial1
  if (myGNSS.begin(Serial1) == false) {
    Serial.println("Ublox GNSS not detected at default I2C address. Please check wiring.");
    while (1);
  }
  Serial.println("Ublox GNSS detected.");
}

void loop() {
  // Get the latest available GNSS data
  if (myGNSS.getPVT() == true) { // Will return false if no valid data is available
    Serial.print("Latitude: ");
    Serial.print(myGNSS.getLatitude(), 7);
    Serial.print(" Longitude: ");
    Serial.print(myGNSS.getLongitude(), 7);
    Serial.print(" Altitude: ");
    Serial.println(myGNSS.getAltitude());
  }
  delay(1000);
}

Unfortunately still not working :confused: (And I tried again with the classic serial1.available() just to be sure and it works)

Here is what I get in the IDE:

21:34:17.657 -> SparkFun u-blox Example
21:34:17.690 -> createFileBuffer: Warning. fileBufferSize is zero. Data logging is not possible.
21:34:17.788 -> 
21:34:17.788 -> Sending: CLS:CFG ID:0x0 Len: 0x1 Payload: 1
21:34:17.820 -> sendCommand: Waiting for ACK response
21:34:18.910 -> waitForACKResponse: TIMEOUT after 1100 msec.
21:34:18.943 -> begin: isConnected - second attempt
21:34:18.976 -> 
21:34:18.976 -> Sending: CLS:CFG ID:0x0 Len: 0x1 Payload: 1
21:34:19.041 -> sendCommand: Waiting for ACK response
21:34:20.122 -> waitForACKResponse: TIMEOUT after 1100 msec.
21:34:20.155 -> begin: isConnected - third attempt
21:34:20.188 -> 
21:34:20.188 -> Sending: CLS:CFG ID:0x0 Len: 0x1 Payload: 1
21:34:20.254 -> sendCommand: Waiting for ACK response
21:34:21.322 -> waitForACKResponse: TIMEOUT after 1101 msec.
21:34:21.355 -> u-blox GNSS not detected. Please check wiring.

For the one who might have this issue too:

I was doing everything correctly but it was because of the ArduSimple configuration which has conflicting with the code.

On u-center, go to UBX-CFG-CFG to restore the default u-blox configuration. Select “Revert to default configuration” and click “Send”.

Then “Save current configuration” and “Send” again.

Also just in case, make sure you have the good firmware in using UBX-MON-VER. It should be 1.32 for best results.

Last thing, after having restored the f9p default configuration, do not touch at all to UBX-CFG-PRT. For the protocol in, do not put anything or it will not work, even “none”.