No serial.print from GPS

I'm using an FV-M8 from San Jose Navigation. And sketch is from p129 of Arduino Cookbook. I see data from GPS and on RX pin of BoArdunio (clone). But, see nothing on Serial Monitor. The waveform is negative going to about 0.5 volts from about +3 volts.

#include <NewSoftSerial.h>
const int rxpin = 2;
const int txpin = 3;
NewSoftSerial serial_gps(txpin, rxpin);

void setup()
{
Serial.begin(9600);
serial_gps.begin(4800);
}

void loop()
{
if (serial_gps.available() > 0)
{
char c = serial_gps.read();
Serial.print(c, BYTE);
}
}

The waveform is negative going to about 0.5 volts from about +3 volts.

Are you saying that the idle state of the line is HIGH (+3V)?

If it is, you'll need to invert it either in hardware or software.

It sure seems that way, for every now and then, I see the baseline at 3 volts. But, I'm not seeing even garbage on Serial Monitor. This GPS has wires for a 2nd channel, TX2 and RX2, but I believe wires were brought for a special option. On TX2, I see a steady High. The baud speed of this GPS is 4800. I have had it running before using a TTL to RS232 converter, just sent to Hyper terminal. But, here in this setup, not output. So you really think I must invert the output? This GPS is very common and sold by Sparkfun. I think it should work.

To see if inverting the logic helps:

NewSoftSerial serial_gps(txpin, rxpin, true);

You have Rx and Tx swapped. Change this:

NewSoftSerial serial_gps(txpin, rxpin);

to this:

NewSoftSerial serial_gps(rxpin, txpin);

No, nothing helps. Tried false and true reversed tx and rx pins. The data is there on RX pin, but Serial Monitor just sits there blank.

Can you post the scope trace of the start of a sentence?

I'll try. Got a LeCroy scope. I could take picture of it. Got to get some chow now, but be back in a bit.

here is a picture

IMG_0415ra.jpeg

That's a rising edge trigger?
Doesn't look like it needs inverting then.
Timing looks about right for 4800 too.

On the other hand, it doesn't really look a lot like you originally described it.
Hmm.

Is that supposed to be one character? It looks like the data is 11 bits long?!? Even with one start bit and a Parity bit that still means 9 bits of character. Not normal. :frowning:

Let's start by seeing if the GPS works. Upload the below sketch which "effectively" disables the Atmega chip and sends the serial signals directly from the GPS to serial monitor.

void setup(){
  pinMode(0,INPUT);
  digitalWrite(0,LOW);
  pinMode(1,INPUT);
  digitalWrite(1,LOW);
}

void loop(){
  while(1);
}

Connect the Tx pin of the GPS to the Tx pin (not Rx) of the Arduino. Since the baud rate is 4800 then set serial monitor to 4800 and you should see NMEA sentences start scrolling on the screen, if you don't then you have some other hardware problem.

OK wayneft, I did what you said, even I don't understand exactly. I do see stuff across the screen when I click Serial Monitor, but all garbage characters. I just noticed screen is frozen, might have to reboot. Probably need to change to 4800 on Serial Terminal. I'll try next time when I reboot.

I actually did test the GPS on XP using a TTL-RS-232 cable and Hyper Terminal. It works fine.
Thanks for sticking around. Be back.

OK, tried again with SM at 4800 like the GPS. See good clear GPS sentences ! :slight_smile: Never have seen anything before using sketch from book. You think it may be timing? By the way OS is Ubuntu 10.04. What to next to try?

Try this code again but this time don't connect the GPS Rx pin to the Arduino and change the Serial Monitor baud rate to 115200

#include <NewSoftSerial.h>
const int rxpin = 2;
const int txpin = 3;
NewSoftSerial serial_gps(rxpin, txpin);

void setup()
{
  Serial.begin(115200);
  serial_gps.begin(4800);
}

void loop()
{
  if (serial_gps.available() > 0)
  {
    char c = serial_gps.read();
    Serial.print(c, BYTE);
  }
}

Hey wayneft!

Found the trouble. The sketch picture was wrong. I used RX0 and TX1 as shown, instead of pin 2 and 3. As soon as I moved wire from RX0 to pin 2, lots of joy, and lots of data on SM. Of course pin 3 is not needed.

What is RX0 and TX1 used for. I really went by the picture which show wires to these pins. Sketch shows const int rxpin = 2; and const int txpin = 3;

Onward! Thanks again...Don

Awesome! Glad to hear it.

Here is the figure that should have been used in the book. I will correct this on the next edition.

Michael Margolis

Thank you Mr. Margolis. Your book has been and will continue to be very helpful. Thanks for the updated hookup picture. Take care, Don