Go Down

Topic: Portenta H7:  (Read 316 times) previous topic - next topic

Petrovim

Hi,

According to Portenta Tech Spec:
"Use any of the existing industrial MKR shields on it"

But in Arduino IDE the e.g. Arduino MKR GPS Shield is inkompatible with -Arduino Portenta H7 (M7 core)-.

I tried also the libary from -SparkFun SAM-M8Q GPS Breakout- but without success.

Any idea why?

Thank you

Mario

jwestmoreland

Hello Mario,

I don't have that shield - but I took a look - and it appears it should work.

Note, you should update your Portenta to the latest firmware rev, since the GPS shield uses Serial1/UART1 and the 'older' firmware will dump a log from the WiFi I/F at boottime that will goof up the GPS device probably.

I compiled the following OK in the latest 0.1.2 IDE - note the changes added for pinMode() - just to make sure that gets remapped - the lib code probably will work without that - but for GPS.begin() you need to pass the
GPS_MODE_UART string - and it appears the lib picks Serial1.

Code: [Select]
*
  GPS Location

  This sketch uses the GPS to determine the location of the board
  and prints it to the Serial monitor.

  Circuit:
   - MKR board
   - MKR GPS attached via I2C cable

  This example code is in the public domain.
*/

#include <Arduino_MKRGPS.h>

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // If you are using the MKR GPS as shield, change the next line to pass
  // the GPS_MODE_SHIELD parameter to the GPS.begin(...)
  pinMode(PI_0, OUTPUT);                 // SPI2_SS/D7 to Output EXTINT
  if (!GPS.begin(GPS_MODE_UART)) {
    Serial.println("Failed to initialize GPS!");
    while (1);
  }
}

void loop() {
  // check if there is new GPS data available
  if (GPS.available()) {
    // read GPS values
    float latitude   = GPS.latitude();
    float longitude  = GPS.longitude();
    float altitude   = GPS.altitude();
    float speed      = GPS.speed();
    int   satellites = GPS.satellites();

    // print GPS values
    Serial.print("Location: ");
    Serial.print(latitude, 7);
    Serial.print(", ");
    Serial.println(longitude, 7);

    Serial.print("Altitude: ");
    Serial.print(altitude);
    Serial.println("m");

    Serial.print("Ground speed: ");
    Serial.print(speed);
    Serial.println(" km/h");

    Serial.print("Number of satellites: ");
    Serial.println(satellites);

    Serial.println();
  }
}


I think that should work for the GPSLocation.ino file - just make sure you get the latest rev of firmware in the 1.2.2 Arduino-mbed code.

HTH,
John W.

Go Up