Go Down

Topic: NEOGPS and NEOHWSerial (Read 199 times) previous topic - next topic

Metalwave

Ok, I'm having a problem with NEOGPS using the ISR. I'm thinking it's something to do with the NeoHWSerial but I'll state right now that I'm a weekend programmer and may be doing something nooblike. Some quick background, I have an Adafruit ultimate GPS connected to Serial1 on a Teensy 3.6. It works great using NeoGPS in polling mode, however I really want the ISR working (conceptually cooler I think  :) )

I'm getting a compiler error in the arduino IDE that states that NeoSerial and NeoSerial1 are not defined. I've included NeoHWSerial.h and modified GPSPort and NeoGPScfg as specified (great instructions btw), and reinstalled the NeoHWserial library (using IDE 1.8.5). As far as I can tell, the library is correctly installed - if I delete some lines in NeoHWSerial.h or .cpp the compiler gets angry at me...

So now I'm focused on NeoHWserial and used the example sketch on Github for NeoSerial:

#include <NeoHWSerial.h>

volatile uint32_t newlines = 0UL;

static void handleRxChar( uint8_t c )
{
  if (c == '\n')
    newlines++;
}

void setup()
{
  NeoSerial1.attachInterrupt( handleRxChar );
  NeoSerial1.begin( 115200 ); // Instead of 'Serial1'
}

void loop() {
  // put your main code here, to run repeatedly:

}

Same problem... NeoSerial1 remains undefined. I'm a little stumped here on where to go next so here I am in the forums! If anyone can help point me to a solution or at least another path to try, I'd appreciate it.

pylon

NeoHWSerial doesn't work with a Teensy 3, it's written for AVR processors only.

Metalwave

So is there a way to use NEOGPS in an ISR mode on a Teensy?

pylon

Quote
So is there a way to use NEOGPS in an ISR mode on a Teensy?
Yes, there is a way: write your own library for the Teensy with the functionality of NeoHWSerial.

Do you really need the ISR mode in NeoGPS?

Metalwave

Right now I'm using a timer interrupt to parse the NeoGPS message and it works fine I suppose. I'm just reaching out to see if anyone else has had this issue. Using the ISR mode looks like a slick idea, which is why I'm trying to get it to work.

Don't know if I have the programming experience to tackle writing that kind of library. But I am looking into it.

pylon

Quote
Right now I'm using a timer interrupt to parse the NeoGPS message and it works fine I suppose. I'm just reaching out to see if anyone else has had this issue. Using the ISR mode looks like a slick idea, which is why I'm trying to get it to work.
Even using a timer interrupt sounds like a huge overkill for just parsing a GPS message. Is you loop so crowded that you need to use an interrupt to keep that simple timing? That might be the point to clean it up.

Doing anything with a Serial object inside an interrupt isn't a good idea. As the serial interface itself depends on interrupts to work you might end up in an endless loop.

Go Up