Arduino with GPS problem

Hi,

I am currently working on project to connect an old serial GPS receiver (old TomTom receiver for connection to an old HP iPaq), to my Arduino Mega 1280. When I connect it to my pc serial interface, I receive clear NMEA sentences, but when I connect it to my Arduino, it stops. It will only output rubbish:
For example:

???Lf????/5d???n?|?r%??????,?f????,?f??M-?/5g????.%K._?:&2:."F&"N*6>F&>N??????3c?2&N?????&??34??2g?N??s??????fM?g??n?|???9?9??M3??3c?6:N:&N>&N:N>2NNNNNN6F*N:FN:FV2*??n?|??2?M3?3????32?22?3???33?3??2e?:2N2N6:N&.N>.N6*N>&N*:N6"&N2V"???n?|??2?M3?3????&?M3f?6"N6.N:N6&N:6N26N6N:2N>"N:&N>"N>N222NV"2??n?|??2?M3?3????3c?>*N6&NV.:??n?|?RK??32f?."F&"N??Sf????2????,????3c?2&N???f????????Lf????/5d???n?|?r%??????,?f????,?f??M-?/5g????.%K._?:&2:.F&"N*6>F&>N??????3c?2&N?????&??34??2g?N??s??????fM?]??n?|?RK??32f?.F&"N??Sf????2????,????3c?2&N???f????????Lf????/5d???n?|?r%??????,?f????,?f??M-?/5g????.%K._?:&2:.F&"N*6>F&>N??????3c?2&N?????&??34??2g?N??s??????fM?.y?n?|?RK??32f?.F&"N??Sf????2????,????3c?2&N???f????????Lf????/5d???n?|?r%??????,?f????,?f??M-?/5g????.%K._?:&2:*>F&"N*6>F&>N??????3c?2&N?????&??34??2g?N??s??????fM?d??n?|?RK??32f?*>F&"N??Sf????2????,????3c?2&N???f????????Lf????/5d???n?|?r%??????,?f????,?f?

I tried several things so far, but nothing worked. The baud rate is correct, it is 4800 and when I connect it to my computer it is working with 4800. I tried the SoftwareSerial on port 10 and 11, as well on port 50 and 51. I tried the onboard serial interfaces. All the same result. I receive information, but the incorrect one.

My code is this: (Arduino IDE 1.0.1)

#include <SoftwareSerial.h>
SoftwareSerial mySerial(50, 51);

void setup()  
{
  Serial.begin(4800);
  Serial.println("Tom Tom GPS NMEA test!");

  mySerial.begin(4800);
  
}

void loop()
{

  if (mySerial.available()) {
      Serial.write(char(mySerial.read()));
  }
  if (Serial.available()) {
      mySerial.print((char)Serial.read());
  }
}

I don't know what to try anymore. Hopefully someone can help.

Thanks!

Regards,

Bastiaan

When I connect it to my pc serial interface, I receive clear NMEA sentences

Which means that the GPS outputs RS232 levels (+/-12V).

but when I connect it to my Arduino, it stops.

I risk frying it...

You need a MAX232 (or similar) chip in between to convert the RS232 levels to the TTL levels that are safe for, and understandable by, the Arduino.

Apart from changing the serial voltage level i think max232's also invert the data so 0xff becomes 0x00 and viseversa, i dont know about atmels but i know pic's have an invert bit set.

i dont know about atmels but i know pic's have an invert bit set.

SoftwareSerial can invert the data. There is an optional 3rd argument to the constructor.

Thanks, that was the problem!

Bastiaan