fazril fazil
fazril fazil

Reputation: 11

Unable to connect Arduino NANO 33 IOT to NEO 6M GPS module

I am trying to connect Arduino NANO 33 IOT to NEO 6M GPS. I understand, SoftwareSerial does not work for this case as it uses Hardware serial that can be assigned to different pins.

I tried this connection:

Arduino 33 IOT RX0 -> Neo RX,

Arduino 33 IOT TX1 -> Neo TX,

Arduino 33 IOT 3.3V -> VCC,

Arduino 33 IOT GND -> GND,

With the below code:

#include <Arduino.h>

#include "wiring_private.h"

Uart mySerial (&sercom0, 1, 0, SERCOM_RX_PAD_1, UART_TX_PAD_0);

// Attach the interrupt handler to the SERCOM

void SERCOM0_Handler()

{

mySerial.IrqHandler();

}

void setup() {

// Reassign pins 1 and 0 to SERCOM alt

pinPeripheral(1, PIO_SERCOM_ALT);

pinPeripheral(0, PIO_SERCOM_ALT);

// Start my new hardware serial

mySerial.begin(9600);

}

void loop() {

// Do something with mySerial...

}

I am getting the below error message while compiling:

'PI0_SERCOM_ALT' was not declared in this scope.

Any help would be greatly appreciated.

Thanks in advance!

Upvotes: 0

Views: 395

Answers (1)

Juraj
Juraj

Reputation: 3736

The Arduino SAMD core already has Serial instance for RX and TX pins of the Nano 33 IoT. This is defined in variant.h/.cpp as

#define PIN_SERIAL1_RX       (0ul)
#define PIN_SERIAL1_TX       (1ul)
#define PAD_SERIAL1_TX       (UART_TX_PAD_2)
#define PAD_SERIAL1_RX       (SERCOM_RX_PAD_3)

Uart Serial1( &sercom5, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX );

Note: wire transmit (TX) to receive (RX) pin between Arduino and the GPS module

Upvotes: 0

Related Questions