Go Down

Topic: No serial.print from GPS (Read 2878 times) previous topic - next topic

donde

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);
  }
}

AWOL

Quote
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.

donde

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.

johnwasser

To see if inverting the logic helps:

Code: [Select]

NewSoftSerial serial_gps(txpin, rxpin, true);
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

wayneft

You have Rx and Tx swapped. Change this:
Code: [Select]
NewSoftSerial serial_gps(txpin, rxpin);

to this:

Code: [Select]
NewSoftSerial serial_gps(rxpin, txpin);

donde

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.

AWOL

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

donde

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.

donde

here is a picture

AWOL

#9
Jun 01, 2011, 07:44 pm Last Edit: Jun 01, 2011, 07:46 pm by AWOL Reason: 1
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.

johnwasser

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. :(

Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

wayneft

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. 

Code: [Select]

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.

donde

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.

donde

OK, tried again with SM at 4800 like the GPS. See good clear GPS sentences !  :) 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?

wayneft

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

Code: [Select]

#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);
  }
}

Go Up