Arduino R4 WiFi and Sparkfun Neo-M9N GPS breakout board (QWIIC)

Hi

I’m a newcomer to Sparkfun QWIIC sensors and have run into a problem when I connect up an Arduino R4 WiFi with the Sparkfun Neo-M9N breakboard board using the QWIIC connectors.

Having trawled though multiple posts on QWIIC issues, I was aware that I would have to make a change to Wire.begin(); to Wire1.begin(); but when I upload the sketch to the Arduino R4, select the Serial Monitor and set the baud rate to 115200, absolutely nothing appears on the monitor.

Any suggestions as to why this might be the case? . I have pasted the BasicNMEARead.ino example sketch below.

Best regards

Joe C


/*

Read NMEA sentences over I2C using Ublox module SAM-M8Q, NEO-M8P, ZED-F9P, etc

By: Nathan Seidle

SparkFun Electronics

Date: August 22nd, 2018

License: MIT. See license file for more information but you can

basically do whatever you want with this code.

This example reads the NMEA setences from the Ublox module over I2c and outputs

them to the serial port

Feel like supporting open source hardware?

Buy a board from SparkFun!

ZED-F9P RTK2: https://www.sparkfun.com/products/15136

NEO-M8P RTK: https://www.sparkfun.com/products/15005

SAM-M8Q: https://www.sparkfun.com/products/15106

Hardware Connections:

Plug a Qwiic cable into the GPS and a BlackBoard

If you don’t have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)

Open the serial monitor at 115200 baud to see the output

*/

#include <Wire.h> //Needed for I2C to GPS

#include “SparkFun_Ublox_Arduino_Library.h” //Click here to get the library: http://librarymanager/All#SparkFun_Ublox_GPS

SFE_UBLOX_GPS myGPS;

void setup()

{

Serial.begin(115200);

Serial.println(“SparkFun Ublox Example”);

Wire1.begin();

if (myGPS.begin() == false)

{

Serial.println(F(“Ublox GPS not detected at default I2C address. Please check wiring. Freezing.”));

while (1);

}

//This will pipe all NMEA sentences to the serial port so we can see them

myGPS.setNMEAOutputPort(Serial);

}

void loop()

{

myGPS.checkUblox(); //See if new data is available. Process bytes as they come in.

delay(250); //Don’t pound too hard on the I2C bus

}

instead of

if (myGPS.begin() == false) 

do :

if (myGPS.begin(Wire1) == false)

Paul

Thank you for a very prompt response. I look forward to amending the code in the morning and seeing how things work out.

All the best

Joe C

Also add while (!Serial); after Serial.begin(115200).

It will take some time for the serial connection to be established through the on-board / pass through ESP32.

Paul

I made the recommended changes, uploaded the revised sketch, opened the Serial Monitor at 115200 baud and waited and waited but still nothing - not even the the introductory “SparkFun ublox Example” message.

Any additional suggestions?

Joe

Here is the revised sketch:

/*

Read NMEA sentences over I2C using u-blox module SAM-M8Q, NEO-M8P, ZED-F9P, etc

By: Nathan Seidle

SparkFun Electronics

Date: August 22nd, 2018

License: MIT. See license file for more information but you can

basically do whatever you want with this code.

This example reads the NMEA setences from the u-blox module over I2c and outputs

them to the serial port

Feel like supporting open source hardware?

Buy a board from SparkFun!

ZED-F9P RTK2: https://www.sparkfun.com/products/15136

NEO-M8P RTK: https://www.sparkfun.com/products/15005

SAM-M8Q: https://www.sparkfun.com/products/15106

Hardware Connections:

Plug a Qwiic cable into the GNSS and a BlackBoard

If you don’t have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)

Open the serial monitor at 115200 baud to see the output

*/

#include <Wire.h> //Needed for I2C to GNSS

#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //Click here to get the library: http://librarymanager/All#SparkFun_u-blox_GNSS

SFE_UBLOX_GNSS myGNSS;

void setup()

{

Serial.begin(115200);

while(!Serial);

Serial.println(“SparkFun u-blox Example”);

Wire1.begin();

if (myGNSS.begin(Wire1) == false)

{

Serial.println(F(“u-blox GNSS not detected at default I2C address. Please check wiring. Freezing.”));

while (1);

}

myGNSS.setI2COutput(COM_TYPE_UBX | COM_TYPE_NMEA); //Set the I2C port to output both NMEA and UBX messages

myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR

//This will pipe all NMEA sentences to the serial port so we can see them

myGNSS.setNMEAOutputPort(Serial);

}

void loop()

{

myGNSS.checkUblox(); //See if new data is available. Process bytes as they come in.

delay(250); //Don’t pound too hard on the I2C bus

}

do you get the message “sparkFun u-blox Example” or “u-blox GNSS not detected at default I2C address. Please check wiring. Freezing”

also put a serial.println() debug message in loop() and check that Serial works.

Paul

Absolutely nothing on the Serial Monitor - not even the “Sparkfun u-blox Example” message.

The only wiring is a short QWIIC connector cable between the GPS board and the R4 (plus the GPS Antenna).

Regards

Joe

looks to me another problem than the NEO sketch.

is your serial monitor set to 115200 / 8n1?

try this sketch below it should print the increasing counter value

void setup() {
  Serial.begin(115200);         // make sure your Serial Monitor is also set at this baud rate.
  while(!Serial);
  Serial.println("Hallo world");
}

void loop() {
  static int count = 0;
  Serial.print("Counter value ");
  Serial.println(count);
  count++;
  delay(1000);
}

Paul

It’s not printing the “Hallo World” message in the Setup but printing the “Counter Value” and incrementing the count correctly in the Void loop.

Question - how do I specify the 8n1 syntax? I know what it means but have never gone about specifying it ever before.

Thanks for you perserverance

Joe

Ok, that is progress. I would have expected “Hallo world”. Add a delay(2000); after Serial.begin(). Now you should see that.

The 8N1 ( 8 bits, No parity, 1 Stopbit) is not necessary to check anymore as you have the right output.

paulvha:
do you get the message “sparkFun u-blox Example” or “u-blox GNSS not detected at default I2C address. Please check wiring. Freezing”

also put a serial.println() debug message in loop() and check that Serial works.

I got "“u-blox GNSS not detected at default I2C address. Please check wiring. Freezing”. I can get very slow and limited response from the GPS by using

#include <Wire.h>

#define GPS_ADDR 0x42 // GPS module address

void setup() {

Wire1.begin(); // Initialize Wire1 for I2C communication

Serial.begin(115200); // Initialize serial communication for debugging

Serial.println(“sketch_may1a: setup…”);

}

void printBinary(byte b) {

for (int i = 7; i >= 0; i–) {

Serial.print((b >> i) & 1);

}

}

void loop() {

Wire1.beginTransmission(GPS_ADDR); // Begin transmission to GPS module

Wire1.write(0x00); // Send command to request status (assuming 0x00 is the command)

Wire1.endTransmission(); // End transmission

delay(100); // Wait for GPS module to process command

Wire1.requestFrom(GPS_ADDR, 1); // Request 1 byte from GPS module

while (Wire1.available()) { // Loop while data is available

char status = Wire1.read(); // Read status byte

Serial.print(status); // Print status byte in hexadecimal format

Serial.print(" ");

Serial.print(status, HEX); // Print status byte in hexadecimal format

Serial.print(" ");

printBinary(status);

Serial.println(“”);

}

delay(100); // Wait before requesting status again

}

but I need fast comprehensive response from the GPS. Which library should I be using for the model SparkFun GPS Breakout - NEO-M9N, SMA (Qwiic) - GPS Board??? :?: :!:

p.s. I tried https://github.com/sparkfun/SparkFun_u- … no_Library and https://github.com/sparkfun/SparkFun_u-blox_GNSS_v3 but no success with either. 100 % sure it’s user error, just not sure what isn’t working.

Paul

As suggested, I added the 2s delay after the Serial.begin(115200); line but, as before, the “Hallo World” text does not appear in the Serial Monitor.

I was thinking of abandoning the R4 and switching to an Arduino Due (because of its 3.3V logic level) but then discovered that the Due I2C does not support “clock stretching” which is used by U-Blox GPS modules.

Regards

Joe C