Hey everyone,

I'm having some trouble configuring my EM-406A to output. About half of the time, the output is just junk. I have 3+ satellites in view, have tried all sorts of different baud rates, and searched all over and can't seem to figure it out. Here's some example output:

Current GPS: 2911.3540,08102.7931
Current GPS: ,,*1.3540,08102.7931
Current GPS: 2911.3528,08102.7938
Current GPS: 179,14,09,,044,15,24
Current GPS: 179,14,09,,044,15,24
Current GPS: 22,30,27,,12,,,,,,,3
Current GPS: 2911.3511,08102.7968

As you can see, the first, third and last are the only correct outputs. Here's the code I'm using on the Mega:

byteGPS = 0;
  i = 0;
  
  while(byteGPS != 42) {                   // read the GGA sentence
    byteGPS = mySerial.read();        
    inBuffer[i]=byteGPS;              
    i++; 
  }
   
  k = 1;
  m1 = 0;
  m2 = 0;
  
  while(inBuffer[k] != 42) {
    k++;
  
    if(k > 17 && k < 27) {
      //Serial.print(inBuffer[k]);            // write the GGA sentence
      currentGPSlat[m1] = inBuffer[k];
      m1++;      
    }
 
     if(k > 29 && k < 40) {
      //Serial.print(inBuffer[k]);            // write the GGA sentence
      currentGPSlong[m2] = inBuffer[k];
      m2++;      
    }   


Even when I'm just outputing the NMEA string, I get either a bunch of commas, or junk in general.

Any troubleshooting advice would be appriciated!

Tags: Arduino, EM406, GPS, Mega

Views: 110

Reply to This

Replies to This Discussion

I am having the same issue as you were having above, only more so. I have my EM-408 hooked up to the serial port on my computer, and when I run a serial terminal program all I get is gibberish. If you stare at the output and squint your eyes you can see some form to the code, but it's all garbage symbols. The port in configured as 4800,8,N,1 and all permutations of other settings either yield similar results, or nothing.

Does anyone have any suggestions as to what is happening? My only thought is we are currently working in the basement of a build and there is no way it's getting GPS lock. I would expect to be receiving bad GPS data in this case, but I would have thought the message header and format would still be correct. Below is a sample of the data I am receiving if you can make sense of it.

Any ideas or suggestions would be great.

%—._§>:6>.&F>2>NNNNN>N>>NNNÊ9ófšæš–ššæææfM™™y=%—+_§ú9Óæššššššššššššššš5guÊÖnâù‰Éeåš3šgšg3š3æšææšæææššgæšææšæææššfg§>>N>>>NN6"N>>N>>>NV"ò)Önâù‰Éeåš3š3šg3šgc§>>N>>>NN>"N>>N>>>NN>.N>>N>>>NN6.N>>N>>>NV"&ÊÖnâù‰Éeåš3šfšg3šg2šææšæææšš3Ìšææšæææšš32šææšæææšš3c§>>N>>>NV"ÊÖnâùÙ¥K/šŠfææ™24&ææš*ššššššš3c>>&NNV6:ÊÖ%—._§>:6>."F>2:NNNNN>N>>NNNÊ9ófšæš–ššæææfM™™y=%—+_§ú9Óæššššššššššššššš5guÊÖnâùÙ¥K/šŠfææ™24&Šæš*ššššššš3c>>&NNV6:ÊÖ%—._§>:6>.F>.:NNNNN>N>>NNNÊ9ófšæš–ššæææfM™^yënâù‰É¥9Ó9Óæššššššššššššššš5guÊÖnâùÙ¥K/šŠfææ™Ì4æ™æš*ššššššš3c>>&NNV6ÊÖ%—._§>:6>.F>2>NNNNN>N>>NNNÊ9ófšæš–ššæææfM™/yënâù‰É¥9Ó9Óæššššššššššššššš5guÊÖnâùÙ¥K/šŠfææ™Ì4&ææš*ššššššš3c>>&NNV6ê)Ö%—._§>:6>*>F>2>NNNNN>N>>NNNÊ9ófšæš–ššæææfM™fyënâù‰É¥9Ó9Óæššššššššššššššš5guÊÖnâùÙ¥K/šŠf抙fš&ææš*ššššššš3c>>&NNV6&ÊÖ%—._§>:6>*:F>.:NNNNN>N>>NNNÊ9ófšæš–ššæææfM™™y=%—+_§ú9Óæššššššššššššššš5guÊÖnâù‰Éeåš3šgšg3š3æšææšæææššgæšææšæææššfg§>>N>>>NN6"N>>N>>>NV"ò)Önâù‰Éeåš3š3šg3šgc§>>N>>>NN>"N>>N>>>NN>.N>>N>>>NN6.N>>N>>>NV"&ÊÖnâù‰Éeåš3šfšg3šg2šææšæææšš3Ìšææšæææšš32šææšæææšš3c§>>N>>>NV"ÊÖnâùÙ¥K/šŠf抙f𿙿š*ššššššš3c>>&NNV6:ÊÖ%—._§>:6>*6F>2:NNNNN>N>>NNNÊ9ófšæš–ššæææfM™Šž=%—+_§ú9Óæššššššššššššššš5guÊÖnâùÙ¥K/šŠf抙34&Šæš*ššššššš3c>>&NNV6*ÊÖ%—._§>:6>*2F>2:NNNNN>N>>NNNÊ9ófšæš–ššæææfM™gyënâù‰É¥9Ó9Óæššššššššššššššš5guÊÖnâùÙ¥K/šŠf抙34&Šæš*ššššššš3c>>&NNV6.ÊÖ%—._§>:6>*.F>.:NNNNN>N>>NNNÊ9ófšæš–ššæææfM™gyënâù‰É¥9Ó9Óæššššššššššššššš5guÊÖnâùÙ¥K/šŠf抙™4æ™æš*ššššššš3c>>&NNV6.ÊÖ%—._§>:6>**F>2:NNNNN>N>>NNNÊ9ófšæš–ššæææfM™dyënâù‰É¥9Ó9Óæššššššššššššššš5guÊÖnâùÙ¥K/šŠf抙™4&Šæš*ššššššš3c>>&NNV66ÊÖ%—._§>:6>*&F>2>NNNNN>N>>NNNÊ9ófšæš–ššæææfM™eyënâù‰É¥9Ó9Óæššššššššššššššš5guÊÖnâù‰Éeåš3šgšg3š3æšææšæææššgæšææšæææššfg§>>N>>>NN6"N>>N>>>NV"ò)Önâù‰Éeåš3š3šg3šgc§>>N>>>NN>"N>>N>>>NN>.N>>N>>>NN6.N>>N>>>NV"&ÊÖnâù‰Éeåš3šfšg3šg2šææšæææšš3Ìšææšæææšš32šææšæææšš3c§>>N>>>NV"ÊÖnâùÙ¥K/šŠf抙24&ææš*ššššššš3c>>&NNV6>ÊÖ%—._§>:6>*"F>.>NNNNN>N>>NNNÊ9ófšæš–ššæææfM™fyënâù‰É¥9Ó9Óæššššššššššššššš5guÊÖnâùÙ¥K/šŠf抙24æ™æš*ššššššš3c>>&
John,

Did you run Ardupilot / ArduIMU code while the GPS was connected? That will put the GPS into binary mode.

I uploaded a small Arduino sketch which will put the GPS back in to text mode for you. Look in my blog.
Ken,

I haven't attached this GPS to anything other than a PC and haven't run any code to communicate with it except for a terminal application. Could it have shipped in Binary mode? And is there a way to get it out of Binary Mode without communicating with it via the serial lines?

Alternatively, where can I get the spec sheet for the binary mode data message? I could easily write a program to interpret the binary if I have to.
Now, lemme think. With the EM-406, the default is text mode. If you command it into binary mode, it will stick there until the SRAM loses power. After the unit has been removed from power for a few days -- 4 to 5, sometimes 6 -- it will revert to text mode, 4800 bps, n,8,1

But, there was something different with the EM-408. I haven't got one of those on hand right now and it's been a few months. But I'm thinking the default was binary mode. You could command it into text, and it would revert to the binary defaults after a few days. Let me see what notes I have on that, but I'm thinking that is how it worked.

Meanwhile, try my program to command the unit into NMEA text mode. The SiRF messages should be the same for both units.
John,

Found my notes. There seems to be a couple of different firmware versions of the EM 408. Some default to NMEA @ 4800 bps. Others default to SiRF binary @ 56,000 or 57,600.

Go to http://www.diydrones.com/profiles/blogs/putting-your-em406-gps-back-in

Look near the bottom of the program. Look for

Serial.begin( 57600 ); // set this to the baud rate that (you hope) your "stuck in binary" GPS is set for

Try 56000 then 57600 in this line. See if the program will throw the GPS into text mode @9600 for you. (You can put the 408 into 4800 bps if you prefer, read the code. About the middle of the file. For 4800 you would use the hex value "0x12C0" broken into 2 bytes: 0x12 and 0xC0 . )

If no worky, try other high bps values and work your way down.

Let me know what data rate you were able to successfully communicate at.
Sam,

You don't check the checksum. You would not know if a character was dropped or inserted or flipped a bit.

You never check to see if the message is valid.

You never check to see if the message is in fact GGA. What if the GPS sends another message?

You set k=1, then loop until k>17. Why waste those cycles? Start k at 18.

You assume that the data will be exactly at position 18 to 26. What if the field size ever grew/shrank? What if a character was ever dropped or inserted? What if a field was invalid and empty?

You waste loops until k >29. Why waste those cycles? Bump k up to 30.

You assume that the data will be exactly at position 30 to 39. What if the field size ever grew/shrank? What if a character was ever dropped or inserted? What if a field was invalid and empty?

Read through your buffer to ensure you have GGA. Read until you get a comma. End of first field. Read until you get a comma. End of second field. Etc.
Yes,

Looking more at the data, I think that the string of commas is from the GSA or GSV message.

Also, you fail to terminate your strings after copying.

You use magic numbers which make the code hard to read and maintain.
Hi,
I think I have the same issue as John. My 406a was giving me the same garbage ( binary ) fresh out of the box.

John did you ever get this working with "putting-your-em406-gps-back-in" ?

NB: the delivery of my GPS took about 3 days... So unless they set it to binary at the suppliers before shipping I dont know what to say...

thanks!
mac
I just wanted to ask if anyone has figured out why the em496a is outputting strange data?

I'm getting null chars in my data. The other issue I found is that I have to open the em406a inverted using newsoftserial.h not sure what the issue is..

Tyler

RSS

Groups

© 2012   Created by Chris Anderson.

Badges  |  Report an Issue  |  Terms of Service