GPS Ignores NEMA commands

jmumby

Senior Member
Hello all,

I have the following

Code:
SETFREQ M8
SEROUT 7,T2400,("$PSRF103,00,00,00,01*24\r\n") 'Turn off GGA
SEROUT 7,T2400,("$PSRF103,01,00,00,01*25\r\n") 'Turn off GLL
SEROUT 7,T2400,("$PSRF103,02,00,00,01*26\r\n") 'Turn off GSA
SEROUT 7,T2400,("$PSRF103,03,00,00,01*27\r\n") 'Turn off GSV
SEROUT 7,T2400,("$PSRF103,04,00,00,01*20\r\n") 'Turn off RMC
SEROUT 7,T2400,("$PSRF103,05,00,00,01*21\r\n") 'Turn off VTG

SEROUT 7,T2400,("$PSRF103,01,01,00,01*24\r\n") 'Turn on GLL

LOOPX:
SERIN 1,T2400,("G"),B1,B2,B3,B4,B5
SERTXD("G",B1,B2,B3,B4,B5,"\r\n")
GOTO LOOPX
When I do this the GPS stops outputting data, in fact if I only put in one command it stops putting out data. If I remove all of the NEMA commands it scrolls thru all the GPGGA,GPGSA,GPGSV etc.

I am using a EM-406a and it uses 2.8v for the serial data, I have connected the TX from the GPS directly to the PICAXE and RX is connected via 2 zener diodes to drop the voltage. I figure this must work as the GPS stops when I send it anything.

Anyone have any ideas, I figure it is the string I am sending down but I have tried all sorts of combinations

Datasheet: http://www.sparkfun.com/datasheets/GPS/EM-406A_User_Manual.PDF

Cheers
 
Last edited:

demonicpicaxeguy

Senior Member
Hello all,

I have the following

Code:
SETFREQ M8
SEROUT 7,T2400,("$PSRF103,00,00,00,01*24\r\n") 'Turn off GGA
SEROUT 7,T2400,("$PSRF103,01,00,00,01*25\r\n") 'Turn off GLL
SEROUT 7,T2400,("$PSRF103,02,00,00,01*26\r\n") 'Turn off GSA
SEROUT 7,T2400,("$PSRF103,03,00,00,01*27\r\n") 'Turn off GSV
SEROUT 7,T2400,("$PSRF103,04,00,00,01*20\r\n") 'Turn off RMC
SEROUT 7,T2400,("$PSRF103,05,00,00,01*21\r\n") 'Turn off VTG
 
SEROUT 7,T2400,("$PSRF103,01,01,00,01*24\r\n") 'Turn on GLL
 
LOOPX:
SERIN 1,T2400,("G"),B1,B2,B3,B4,B5
SERTXD("G",B1,B2,B3,B4,B5,"\r\n")
GOTO LOOPX
When I do this the GPS stops outputting data, in fact if I only put in one command it stops putting out data. If I remove all of the NEMA commands it scrolls thru all the GPGGA,GPGSA,GPGSV etc.

I am using a EM-406a and it uses 2.8v for the serial data, I have connected the TX from the GPS directly to the PICAXE and RX is connected via 2 zener diodes to drop the voltage. I figure this must work as the GPS stops when I send it anything.

Anyone have any ideas, I figure it is the string I am sending down but I have tried all sorts of combinations

Datasheet: http://www.sparkfun.com/datasheets/GPS/EM-406A_User_Manual.PDF

Cheers
the only idea i've got is that gps units with serial ports normally go to a pc serial port i'd try using n2400 instead of t2400
 

Technical

Technical Support
Staff member
Your \r\n are wrong - you are actually sending 4 ASCII characters "\r\n" as part of the string. What you should use is
SEROUT 7,T2400,("$PSRF103,00,00,00,01*24",CR,LF) 'Turn off GGA

CR and LF are predefined contants in the compiler - the numbers 13 and 10.
 

Shack

Member
the only idea i've got is that gps units with serial ports normally go to a pc serial port i'd try using n2400 instead of t2400
You might chect the module data sheet because most are TTL logic and with the Zeners' the voltage may be too low. The SparkFun data sheet has weird characters so not viewable for me.

Also, 2400 is pretty slow for the module and it is probably defaulted at 4800 unless you have changed it. I would try T4800N1 as a start. You did not indicate what Picaxe you are using so maybe that baud rate isn't available to you.

Most modules use true polairty for the serial comm so you will need to set your RX pin on the Picaxe to the module high when you initialize and your data output pin high before you send the data. Additionally, the module may require a minimum of 2-3 seconds after power-on before it will accept any commands.
 

Technical

Technical Support
Staff member
setfreq m8 then 2400 baud is correct for 4800 baud output.
The freezing is because the device is never receiving the CR LF sequence in the original program. So it just waits forever.
 

jmumby

Senior Member
I have tried

SEROUT 7,T2400,("$PSRF103,00,00,00,01*24",CR,LF)

and

SEROUT 7,T2400,("$PSRF103,00,00,00,01*24",13,10)

What gets me is if I send either string I get no response if I write another program without those lines and just the loop it starts sending data again without reseting the GPS. It's almost like the PICAXE hangs after sending the string.

the only idea i've got is that gps units with serial ports normally go to a pc serial port i'd try using n2400 instead of t2400
N gives me no response
 

demonicpicaxeguy

Senior Member
I have tried

SEROUT 7,T2400,("$PSRF103,00,00,00,01*24",CR,LF)

and

SEROUT 7,T2400,("$PSRF103,00,00,00,01*24",13,10)

What gets me is if I send either string I get no response if I write another program without those lines and just the loop it starts sending data again without reseting the GPS. It's almost like the PICAXE hangs after sending the string.



N gives me no response
worth a try, the other thing you might want to try is swapping the cr and lf around so instead of "13,10" try "10,13"
i have been stumped by that one before i've had modules where they say "cr lf" in the data sheet but really mean "lf cr"
 
Last edited:

BCJKiwi

Senior Member
Never used one of these things but just looked at the manual - couple of suggestions,

1. All the examples actually have a space between the $ and PSRF103 (even though the original command info doesn't)

2. Also, all the examples don't have the CR,LF (even though the original command info does)
have you tried the CR,LF out side the quotes?

e.g. SEROUT 7,T2400,("$ PSRF103,05,00,00,01*21",cr,lf) 'Turn off VTG
 

jmumby

Senior Member
Ok,

Heres what I know

If I Send a NEMA command such as

SEROUT 7,T2400,("$PSRF103,00,00,00,01*24",CR,LF)

I get no response which tells me it is getting the command but waits as technical has said.

If I don't send a NEMA command it will receive the NEMA strings as per normal. Using a "G" qualifier I get GPGSA, GPGGA, GPRMC, GPGSV, GPRMC using T2400. If I use N2400 I get nothing unless I remove the qualifier and I get garbage which tells me it must be T2400.

If I send a command such as...

SEROUT 7,N2400,("$PSRF103,00,00,00,01*24",CR,LF)

The unit carrys on as if nothing has sent at all so again I get GPGSA, GPGGA, GPRMC, GPGSV, GPRMC. Which I assume means it must be T2400.

I have found some other documents that say the unit may boot up in SiRF Binary by default so will not accept NEMA commands so I have also tried.

SEROUT 7,T2400,("$PSRF100,1,4800,8,1,0*14",CR,LF)

but still no output.

Other combinations

SEROUT 7,T2400,("$PSRF100,1,4800,8,1,0*14",13,10)
SEROUT 7,T2400,("$ PSRF100,1,4800,8,1,0*14",13,10)
SEROUT 7,T2400,("$PSRF100,1,4800,8,1,0*14",0x0D,0x0A)

Im going to try a voltage divider now in case the zeners are confusing things.
 

BCJKiwi

Senior Member
You have also mentioned 2.85V and referred to a voltage dropper with Zener Diodes to achieve this.

The reference in the manual to this relates to TTL.
Normally this would mean that logic low is 0v and logic high is => 2.85v.
TTL would normally mean capable of 5v - see here http://www.interfacebus.com/voltage_threshold.html.

So how about trying without the Zeners.
 
Last edited:

Technical

Technical Support
Staff member
We've not calculated/checked them - but are you 100% sure the EOR checksum is correct? If this was wrong the command would be ignored. Remember it is the ascii value you are EORing, including the commas.
 

Shack

Member
Ok,

Heres what I know

If I Send a NEMA command such as

SEROUT 7,T2400,("$PSRF",103,00,00,00,01*24,CR,LF)

I get no response
Try this:

SEROUT 7,T2400,(“$PSRF,103,00,00,00,01*24,CR,LF)

Missing comma .... Red ... try it

I would also move the " .... Blue
 

BCJKiwi

Senior Member
I'm wondering why the quotes are there at all, or at least why they are around the whole string of data. The system is expecting a number of diffrent pieces of data not a single chunk.

Suggest you try a string right from the manual so you know the data content is right but with and without the quotes;

SEROUT 7,T2400,("$PSRF103,00,01,00,01*25",cr,lf)
or
SEROUT 7,T2400,($PSRF103,00,01,00,01*25,cr,lf)
or
SEROUT 7,T2400,("$PSRF103","00","01","00","01*25",cr,lf)
 

hippy

Technical Support
Staff member
From what I've read looking up NMEA, the following format would be correct ( even if the numeric values weren't ) ...

SEROUT 7, T2400, ( "$PSRF103,00,01,00,01*25" , CR, LF )

There's no indication of a comma needed after $PSRF, the 103 is part of the command header. The rest of the data up to the end quote has to be ASCII or some values sent could be treated as CR or LF and prematurely terminate the command.
 

Shack

Member
I use the (") and the comma and my stuff works; however, I am using a different module. I see now that they do not use the comma or the quotes".

Also, this module is TTL so I think the the Zeners need to go.

As I read it the unit needs to be put into NMEA mode before it will accept these commands.

$PSRF100,<protocol>,<baud>,<DataBits>,<StopBits>,<Parity>*CKSUM
<CR><LF>


The Evaluation Receiver may be put into NMEA mode by sending the
SiRF binary protocol message &#8220;Switch to NMEA Protocol - Message I.D. 129&#8221; (see
the SiRF Binary Protocol Reference Manual). This can be done by using a user
program or by using the SiRFSDemo software and selecting Switch to NMEA Protocol
from the Action menu (see the SiRF Evaluation Kit User Guide or the SiRFDemo User
Guide). If the receiver is in SiRF binary mode, all NMEA input messages are ignored.
Once the receiver is put into NMEA mode, the following messages may be used to
command the module.
 
Last edited:

jmumby

Senior Member
Thanks to everyone!

The correct result.....

I connected the PIC directly to the GPS and found when the line was low output stopped regardless. If I pulled it high output started. so the following command syntax will work

SETFREQ M8
SEROUT 7,T2400,("PSRF103,02,00,00,01*24",CR,LF) 'Turn off GSA
HIGH 7

Perhaps I am my own worst enemy for not having a pull up resistor?

So contrary to the datasheets I have read the unit does not boot up in SiRF binary.
 

MPep

Senior Member
Hi,

I am using a Navman GPS module that uses the same PSRF sentence structure.

In your Enable GLL sentence, you have:
SEROUT 7,T2400,("$PSRF103,01,01,00,01*24", CR,LF) 'Turn on GLL.

I suspect that this is incorrect.
You need:
serout 7,T2400,("PSRF103,01,00,01,01,*(checksum goes here)",CR,LF).

The third field should have 00, not 01 as this queries the GLL sentence. You need 00 to SetRate.

Query/Rate control:
$PSRF103 = message ID
01 = GLL
00 = Mode (0=SetRate, 1=Query)
01 = Rate (=1 second)
01 = Checksum Enable (00 = disable)
*checksum. Must be calculated correctly, otherwise the GPS engine will disregard the sentence.

See how you go.

PS: NEMA is National Electronics Manufacturer's Association, where-as you are dealing with NMEA, National Marine Electronics Association.

$PSRF stands for Proprietary SiRF protocol. SiRF appears to be standardised, therefore my own manual, and the description above, should be the same and the possible solution above should work the same for you.
 
Last edited:

jmumby

Senior Member
Your are correct Mpep, on both accounts. The NEMA and NMEA typo must be quite common as google comes up with heaps of results for each. Since I found the pull up issue I have been turning on and off output with out too much issue.

I found a program that calculates the checksum so that is covered.
 

MPep

Senior Member
Hi Jmumby,

Am pleased to help.
You are correct that NEMA and NMEA are often used interchangably. Even in the marine electronics industry people say "NEMA" despite meaning NMEA.

I too have a program that calculates the checksum "GPS Diagnostics". Can't remember where I downloaded it from, but very useful.

Regards,
Mark.
 
Top