Activate GPS on M2 using GPIOs

Hello rapid M2M community,

please can someone help me to activate the GPS receiver on the M2 board?

  1. Which GPIOs have to be set in which order to activate the module?
  2. How does the GPIO have to be initialized for the reset? As an input or output, high or low?

Best regards,
Marcel

PS: The internal pullup of the reset, seems to be connected to Vcc.

Hallo @mklueh,

let’s assume we have the following configuration:

  • rapidM2M M2 Board + GPS receiver connected via UART port 1
  • GPIO 3 – GNSS Reset pin
  • GPIO 5 – GNSS Power Enable pin
  • “gnss-microtronics” library for handling the communication from the GPS receiver

Based on that configuration, you have to first initialize the UART1 port for communication with the GPS receiver. In this example this is done by the mentioned library.

/* Enable GPS UART */
GNSS_Init(APP_UART_PORT);

Regarding the GPIOs, both have to be set correctly depending on your hardware.
Both GPIOs have to be set as output, but the with the help of the studio libraries, we can easily set the GPIOs to output and set the necessary level.

/* Power On GPS Module */
digitalWrite(APP_GPS_RESET_PIN, RM2M_GPIO_HIGH);
digitalWrite(APP_GPS_ENABLE_PIN, RM2M_GPIO_HIGH);

Using the “gnss-microtronics” library we should now be able to print the incoming GPS information, since the GPS receiver is initialized and ready for operation:

GNSS_PrintData(GNSS_DEBUG_MODE_WATCH);

With the information above we can now put all those parts together into a small example script like the following, which will print the received GPS information in the #watch panel of the studio and update it every second.

#define APP_UART_PORT      1
#define APP_GPS_RESET_PIN  3
#define APP_GPS_ENABLE_PIN 5

#callback Timer1s()
{
	GNSS_PrintData(GNSS_DEBUG_MODE_WATCH);
}

#callback init()
{
	/* Enable GPS UART */
	GNSS_Init(APP_UART_PORT);

	/* Power On GPS Module */
	digitalWrite(APP_GPS_RESET_PIN, RM2M_GPIO_HIGH);
	digitalWrite(APP_GPS_ENABLE_PIN, RM2M_GPIO_HIGH);

	setInterval(Timer1s, 1000);
}

main()
{
	salve( init);
}

You can also enable the debug mode of the library if you are unsure if your configuration works, because this will print all data comming from the GPS recevier to the console of the studio.

image

I hope this example helps you with the integration of your GPS receiver.

Kind regards,
Stefan

1 Like

Hi Stefan,
thank you for the excellent and detailed answer.
Kind regards,
Marcel