Ultimate GPS plus Arduino Micro?

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
xykobas3rd
 
Posts: 7
Joined: Sat Mar 10, 2012 7:40 pm

Ultimate GPS plus Arduino Micro?

Post by xykobas3rd »

I'm using an Arduino Micro and the Ultimate GPS Breakout v3
Arduino 1.0.5
RX on GPS connected to Pin 2 on Micro
TX on GPS connected to Pin 3 on Micro

When I run the "parsing" sketch it compiles and uploads fine but the Serial Monitor only gives me:

Time: 0:0:0.0
Date: 0/0/200
Fix: 0 quality: 0

Even when the GPS has a fix! (the LED only blinks once every 15 seconds)

When I try to compile the "echo" sketch I get

echo.pde: In function 'void __vector_21()':
echo:96: error: 'UDR0' was not declared in this scope

I noticed that if I changed Tools>Board from Arduino Micro to Arduino Uno it compiles fine.
And I know these sketches work with an Arduino Uno.

What changes do I need to make in order to run these sketches with a Micro?

Thanks.

User avatar
Franklin97355
 
Posts: 23939
Joined: Mon Apr 21, 2008 2:33 pm

Re: Ultimate GPS plus Arduino Micro?

Post by Franklin97355 »

You will probably have to modify the GPS code to run on a micro. It seems the registers are not all implemented on the micro but since I don't use one that is just a guess.

1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am

Re: Ultimate GPS plus Arduino Micro?

Post by 1chicagodave »

Arduino Micro is an ATmega32u4 chip, the same as on a Leonardo.

Are you using the "Leo" example sketches?

User avatar
xykobas3rd
 
Posts: 7
Joined: Sat Mar 10, 2012 7:40 pm

Re: Ultimate GPS plus Arduino Micro?

Post by xykobas3rd »

Interesting.....I was using the default "echo" and "parsing" code.


So I tried "leo_parsing" and changed it from HardwareSerial

Code: Select all

// If using software serial, keep these lines enabled
// (you can change the pin numbers to match your wiring):
//SoftwareSerial mySerial(8, 7);
//Adafruit_GPS GPS(&mySerial);

// If using hardware serial, comment
// out the above two lines and enable these two lines instead:
Adafruit_GPS GPS(&Serial1);
HardwareSerial mySerial = Serial1;
to SoftwareSerial with my pin configuration (3 to GPS TX, 2 to GPS RX)

Code: Select all

// If using software serial, keep these lines enabled
// (you can change the pin numbers to match your wiring):
SoftwareSerial mySerial(3, 2);
Adafruit_GPS GPS(&mySerial);

// If using hardware serial, comment
// out the above two lines and enable these two lines instead:
//Adafruit_GPS GPS(&Serial1);
//HardwareSerial mySerial = Serial1;
but I kept getting
Time: 0:0:0.0
Date: 0/0/200
Fix: 0 quality: 0

Time: 0:0:0.0
Date: 0/0/200
Fix: 0 quality: 0
without the usual
"Adafruit GPS library basic test!"


I opened "leo_echo" and just changed

Code: Select all

SoftwareSerial mySerial(8, 7);
to

Code: Select all

SoftwareSerial mySerial(3, 2);

(to match my original pin configuration)

Upload, and all I got was:
Get version!
I'm so confused.

1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am

Re: Ultimate GPS plus Arduino Micro?

Post by 1chicagodave »

Due to the way SoftwareSerial operates, pin 2 cannot be used for RX with Leonardo (32u4).
http://arduino.cc/en/Reference/SoftwareSerial
Not all pins on the Leonardo support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).
Also, because of the differences between UNO & Leonardo, when attempting the "direct connection" with Leo_echo sketch....you must connect to the pins labelled "RX" & "TX" on the Arduino board.

http://learn.adafruit.com/adafruit-ulti ... n-leonardo

User avatar
xykobas3rd
 
Posts: 7
Joined: Sat Mar 10, 2012 7:40 pm

Re: Ultimate GPS plus Arduino Micro?

Post by xykobas3rd »

Thank you very much!
I should have realized the Micro was based on the Leonardo and therefore would have different specs than the Uno.

Another quick question:
If I'm not using the serial monitor on a project with this GPS, can I remove the following to speed things up?

Code: Select all

  // if millis() or timer wraps around, we'll just reset it
  if (timer > millis())  timer = millis();

  // approximately every 2 seconds or so, print out the current stats
  if (millis() - timer > 1000) { 
    timer = millis(); // reset the timer
     
And just skip to

Code: Select all

if (GPS.fix) {

Thanks again!

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”