Problem connecting to EM-406A GPS

pmolsen

Senior Member
I have 9 Datalogger boards that I modified a couple of years ago to read data at 4800bps from an EM-406A GPS module (http://www.sparkfun.com/commerce/product_info.php?products_id=465). I just get the time and date.

After some initial problems I got them to work and they have been working perfectly for 2 years. The TX from the EM-406 goes to Input 0 (pin 17) of the datalogger board, which also has a 10K resistor to ground.

I have now built my own custom boards, but the 18X refuses to read the EM-406 input at all. The SERIN statement just hangs. The only difference between the two is that the data line from the EM-406 goes to Input 7 (pin 16) instead of Input 0. I have a 10K resistor to ground like the old boards.

Is there any reason why SERIN should work perfectly on Input 0 but not on Input 7?

I have put a scope on the line and the data is there. The TTL output voltage level from the EM-406 is 2.85V according to the spec sheet. The scope reads about 3V.

My program reads the entire GPRMC sentence in one SERIN. I have written a test program that just tries to read just one byte but it also hangs on the SERIN.

Anyone have any suggestions as to what could be wrong. I have run out of ideas.

Here is the relevant code and comments. The initial code checks to see if there appears to be valid data on the pin before doing the SERIN to avoid hanging if GPS is not present or dead.

' Define Input Pin Usage
symbol gpspin = pin7 ; Serial input from EM-406 GPS
symbol gps = 7


' First check GPS input pin to determine if changing data is present.
' If we just do a serin and there is no data (eg. GPS dead or not present)
' then the program hangs forever.
' Pin is held low with a 10k resistor for when no GPS present.
w1 = 0
w2 = 0
for w0 = 1 to 500 ; check pin for about 1 second
if gpspin = 1 then
w2 = w2 + 1
else
w1 = w1 + 1
endif
pause 1
next
if w1 < 10 or w2 < 10 then gpsbad ; No gps serial data present


' Read GPS data and check if data valid.
' If GPS data-valid flag is "A" (good fix) then accept time and date.
' NB. At 8MHz you have to specify 2400bps on serin to read 4800bps data
' Serial data from GPS is True logic (0v=logic 0, 5v=logic 1) so specify T2400
' Read time hhmmss in b1-b6, valid or invalid flag in b7 and date ddmmyy in b8-b13

setfreq m8 ; run at 8MHz to allow reading serial data at 4800bps
serin gps,t2400,("$GPRMC,"),b1,b2,b3,b4,b5,b6,#w6,b7,#w6,#w6,b0,#w6,#w6,b0,#w6,#w6,#w6,#w6,b8,b9,b10,b11,b12,b13
if b7 <> "A" then gpsnolock ; GPS not yet locked on to satellites
 

hippy

Technical Support
Staff member
Is there any reason why SERIN should work perfectly on Input 0 but not on Input 7?

The TTL output voltage level from the EM-406 is 2.85V according to the spec sheet. The scope reads about 3V.
Input pins 6 and 7 on an 18X are Schmitt Trigger inputs, while the others are TTL inputs. The output voltage is probably not giving a high enough level to be detected as a high.

http://www.picaxeforum.co.uk/showthread.php?t=8609
 

jmumby

Senior Member
If you have a max232 of ft232 breakout you should try and communicate between a pc and the 18x. Or serout from one pin to PIN0 and sertxd back to the console. I would suggest the voltage is too low for pin0 but some of the ubergurus will give a more scientific reason for this.

Are you driving the 18x at 3.3v? 18x does not play nice at this voltage, I can vouch for that.

The other thing you could try is removing you qualifier "$GPRMC" and just get it to grab what ever is coming in. In my experience it will be garbage.
 

pmolsen

Senior Member
As usual you are a genius Hippy. Worked perfectly when I changed to input 1 instead. Thanks for that.
 
Top