Shop OBEX P1 Docs P2 Docs Learn Events
Problems getting TTL output from GPS...ideas? — Parallax Forums

Problems getting TTL output from GPS...ideas?

Patrick SmithPatrick Smith Posts: 7
edited 2006-11-10 02:19 in General Discussion
Just got my GPS module in the mail today. I want to send it's output to a Nikon DSLR camera. The Nikon accepts TTL serial data input. I am currently interfacing a Garmin eTrex to the camera and converting it's native RS-232 output to TTL with a MAX232 chip. The Garmin ouputs NMEA 0183 at 4800 baud and I get the GPS indicator immediately on the camera.

Reading the datasheet on the Parallax GPS, connecting the RAW pin to ground will tell it to output raw gps data in NMEA 0183 at 4800 baud on the SIO pin, obviously in TTL. That's the format the camera needs, so it *should* work - but it doesn't. I never get the GPS indicator to come on or flash, even when the GPS LED has been solid for a long time (more than 10 minutes). I'm connecting to the same pins on the camera that work with the TTL output from my current GPS setup.

I even connected to the Polstar GPS chip directly (using the datasheet on their website), bypassing the Parallax board. Still couldn't get the camera GPS indicator on, with a good fix on the chip. BUT! Using the RS232 TX pin from the Polstar, I connected it to my existing RS232>TTL circuit and got the camera input to work. Explain that!

So if anyone can offer any help or suggestions on getting TTL output direct I would appreciate it.

Thanks,
Patrick

Comments

  • ForrestForrest Posts: 1,341
    edited 2006-09-24 05:29
    Double check your Garmin eTrex serial setup on the GPS. My Garmin GPS can output in Garmin Text mode or NMEA mode. Also, double check the speed from the GPS.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-09-24 07:30
    Patrick -

    You ARE connecting the ground terminal as well, right?

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • Patrick SmithPatrick Smith Posts: 7
    edited 2006-09-24 14:23
    Yep, I have the ground pad jumped over to RAW. The eTrex is sending NMEA 4800bps.

    Thanks,
    Patrick
  • Patrick SmithPatrick Smith Posts: 7
    edited 2006-09-25 20:25
    ^^^^^ bump ^^^^^
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-09-26 15:22
    My best suggestion is to comare on a DEBUG/Terminal window the exact strings coming from both devices.· Connecting a TTL output through the MAX232 will have the effect of inverting the signal.· It seems perhaps your camera requires an inverted signal?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Dave PatonDave Paton Posts: 285
    edited 2006-09-26 19:48
    Patrick Smith said...
    I even connected to the Polstar GPS chip directly (using the datasheet on their website), bypassing the Parallax board. Still couldn't get the camera GPS indicator on, with a good fix on the chip. BUT! Using the RS232 TX pin from the Polstar, I connected it to my existing RS232>TTL circuit and got the camera input to work. Explain that!
    I think the Nikon multifunction input is a little wonky when it comes to power and levels. I've been reading about folks connecting their ETrexs and similar GPSs to D2s and D200s and everyone ended up using a level shifter of some sort to make it go. Annoying, but it seems necessary. Perhaps there's a serial polarity issue at work as well? I'd get in there with a multichannel scope and start comparing the bit strings...

    -dave

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    This is not a sig. This is a duck. Quack.
  • Patrick SmithPatrick Smith Posts: 7
    edited 2006-09-26 20:30
    Well my tests would seem to indicate you are correct, Dave. No matter what the Nikon doesn't seem to accept direct TTL serial input. Here are three complete strings that I pulled just a few minutes ago. 1 is direct from the Garmin GPS, 2 is direct from the RS232 out of the Polstar board (note: the Parallax board has been bypassed), and 3 is from the TTL out of the Polstar chip with levels converted via a MAX232 circuit.

    1) From Garmin eTrex:
    $GPRMC,200326,A,4102.7531,N,08138.6014,W,0.0,0.0,260906,8.2,W,A*19
    $GPRMB,A,,,,,,,,,,,,A,A*0B
    $GPGGA,200326,4102.7531,N,08138.6014,W,1,05,1.8,318.8,M,-33.8,M,,*78
    $GPGSA,A,3,,08,11,13,,19,,27,,,,,2.5,1.8,1.6*3C
    $GPGSV,3,1,10,03,32,051,00,08,46,312,37,11,25,157,46,13,28,209,43*70
    $GPGSV,3,2,10,16,03,082,00,19,63,061,42,23,06,184,00,27,75,297,46*78
    $GPGSV,3,3,10,28,24,277,00,29,00,337,00*7A
    $GPGLL,4102.7531,N,08138.6014,W,200326,A,A*56
    $GPBOD,,T,,M,,*47
    $PGRME,7.2,M,12.8,M,14.7,M*22
    $PGRMZ,1046,f,3*28
    $GPRTE,1,1,c,*37
    
    



    2) From the RS232 of the Polstar GPS board:
    $GPRMC,191929,A,4102.7747,N,08138.6007,W,000.0,331.9,260906,,,A*6D
    $GPGGA,191930,4102.7748,N,08138.6007,W,1,03,03.2,00251.8,M,-033.8,M,,*72
    $GPGSA,A,2,13,19,23,,,,,,,,,,03.3,03.2,00.9*00
    $GPGSV,2,1,07,13,46,221,50,15,08,043,00,16,16,069,27,19,71,113,47*76
    $GPGSV,2,2,07,23,24,188,52,27,57,311,00,28,,,00,,,,*71
    
    



    3) And from the TTL output of the Polstar board level shifted to RS232 ouput:
    $GPRMC,195151,A,4102.7935,N,08138.5986,W,000.0,181.2,260906,,,A*64
    $GPGGA,195152,4102.7937,N,08138.5988,W,1,03,06.9,00258.1,M,-033.8,M,,*7F
    $GPGSA,A,2,11,13,23,,,,,,,,,,07.0,06.9,00.9*01
    $GPGSV,3,1,11,03,36,051,00,08,41,311,32,11,21,159,42,13,32,211,46*7D
    $GPGSV,3,2,11,15,04,031,00,16,06,079,00,19,67,069,00,23,10,184,41*7B
    $GPGSV,3,3,11,27,71,304,00,28,20,273,00,35,,,00,,,,*75
    
    



    Now I'm no expert at this but the only significant difference I can see between 2 and 3 is there's one more $GPGSV sentence output from the TTL side. I also have no idea if the Nikon needs reverse polarity and don't have a scope to check. If someone knows how I can flip the TTL ouput polarity and will tell me how, I'll give that a shot. Regardless the RS232 output DOES work as long as you change the levels down to TTL. If I can't get direct TTL to work I need to find the smallest level-shift circuit out there... the MAX232 with 5 caps is a lot more bulky than I wanted.

    Thanks for the help.
    Patrick
  • stamptrolstamptrol Posts: 1,731
    edited 2006-09-27 11:49
    Patrick,

    Are you sure the camera can accept any/all the string types that the Polestar puts out? I would expect the camera to like the most common $GPGLL string and perhaps not accept some of the others.

    You may be able to fool the camera by having a stamp "re-create" a string type the camera will accept.

    Regards,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Patrick SmithPatrick Smith Posts: 7
    edited 2006-09-27 13:43
    I worried about that before I bought it since I didn't have a list of the strings the Nikon accepts. But using the RS232 output from the Polstar *does* work with the levels shifted. Just not with the TTL output directly.

    Thanks,
    Patrick
  • stamptrolstamptrol Posts: 1,731
    edited 2006-09-27 14:00
    Patrick,

    Gotcha, missed that in the posts.

    So, if it works with shifted RS232, using the "inverted" mode in TTL should give a readable signal. If its not possible in the setup of the GPS, feed the GPS's ttl through a transistor or inverter chip. But, now you have extra parts!

    Note that the MAX 233 does the whole level shift without external caps.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Patrick SmithPatrick Smith Posts: 7
    edited 2006-09-27 16:01
    Aha... that makes sense. I'm new to this so could you give me just a little more advice? Would it be easier/smaller to make my own (googling TTL Inverter shows I can make it out of two transistors and a couple resistors) or is there a specific IC that does this? I'm sure there is as it's one of the basic operations, but I don't know how to find the right one.

    Thanks,
    Patrick
  • BeanBean Posts: 8,129
    edited 2006-09-27 16:21
    Patrick,
    · You could possibly reprogram the SX on the GPS module to invert the data for you.
    · Of course you would not use RAW mode then.
    · The SX code would be VERY simple...
    DEVICE          SX20, OSCXT2, TURBO, STACKX, OPTIONX
    FREQ            20_000_000
    
     
    Sio     PIN  RA.3 OUTPUT        ' pull-up via 4.7K
    Gps_rx  PIN  RB.2 INPUT         ' RX from PGM-248
     
    PROGRAM Start
     
    Start:
      Sio = ~Gps_rx
    GOTO Start
     
    END
    
     
    


    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com

    There are only two guaranteed ways to become weathy.
    Spend less than you make.
    Make more than you spend.


    Post Edited (Bean (Hitt Consulting)) : 9/27/2006 4:27:24 PM GMT
  • stamptrolstamptrol Posts: 1,731
    edited 2006-09-27 16:22
    Patrick,

    Just go with the transistor model to see if it will work. With a chip (74LS00, etc), you'll need +5 and 0v to the chip, but it will give you a bit better swing of voltage.

    I usually use a MOSFET (IRL510 or IRL520) because the gate can be hooked directly to the stamp/ttl pin. Hook up something like this:

    +5v to one end of a 470 ohm resistor
    other end of resistor to Drain (or collector) of NPN transistor
    Source (or emitter) of transistor to 0 volts.
    Gate of Mosfet to TTL input. ( or through 1K resistor to base of NPN transistor)
    Serial data is at Drain connection of mosfet with respect to 0v.

    Good luck.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Patrick SmithPatrick Smith Posts: 7
    edited 2006-09-28 21:55
    Well no luck with inverting the TTL signal. It will be a mystery, I guess, until someone that really knows what the Nikon needs comes along and publishes it for all the GPS hackers out there. At least I can make it work off the RS232 pins with a little extra work and space for parts. Thanks for all the help.

    Patrick
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2006-10-07 00:53
    I just bought the Parallax GPS module and am running into problems with it.· I connected it to my BS2 to test it out with the demo software.· Unfortunately, it doesn't work.· The data returned is all garbled.·

    I used a level shifter and sent the data to my PC serial port to take a better look.· The GPS data is fine.

    The data sheet shows that I can connect the SIO pin directly to the BS2 with no additional circuitry.· So, I have 5V going to the BS2 and the GPS module, and ground is connected of course.· The voltage swing on the SIO line is only 3.0v peak to peak.· It's not obvious if this is sufficient for the BS2.· At least, it certainly appears NOT to be.· I'll try doing a read only with the Stamp using level shifted data to 5v.· I haven't gotten to try that yet.· It just seems that I shouldn't have to do this.

    Should the GPS module output a signal that is 5v peak to peak?· Or is 3v peak to peak normal?· If it's normal, does this mean that my BS2 is simply defective in some way?

    Any suggestions for making this work?· Bear in mind that the SIO pin does double duty as an output from the Stamp and an input to it.

    Thank you,
    Joel-
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-07 01:07
    Joel,
    ·
    ·· Are you using the demo code from our website?· Are you sure of the connections?· Also, what happens if you put a 4.7K (or 10K) resistor on the /RAW pin to Vdd?· Can you post a picture of your connections?· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2006-10-07 02:57
    Joel,

    If you do have everything wired up correctly then you might just try using
    another pin on the BS2 for your serial connection to the GPS module.
    Naturally, you will need to change the BS2 demo program source code but
    it's only in one place that you need to do that, line 33. I've had one or two
    pins go <raspberries> on my BS2 so... just a thought.

    If you had your GPS connected to your PC was it receiving a steady stream
    of NMEA sentences or did you manually key in or have a program send the "!GPS"
    commands? If you saw a steady stream of NMEA sentences then you'll need to
    change the /RAW pin to unconnected (or tied to Vdd, as Chris suggests, with a
    resistor) because the BS2 demo program can not deal with a steady stream of
    data like that. Running the GPS module in Raw mode but with the BS2 demo
    program would result in garbled data.

    3.3V is what I normally see at the output from a TTL pin when Vcc (or Vdd in
    this case) is about 5.1volts. This (and your 3v) is more than enough to signal
    a logical one to any TTL system and the Basic Stamps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = KD4WLZ = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking

    Post Edited (Fe2o3Fish) : 10/7/2006 3:00:50 AM GMT
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2006-10-07 03:44
    Hi Chris,

    I am using the demo code from your website. I've checked the connections over, and rewired it a few times just to be sure. It's all OK. I put a 10K resistor on the /RAW pin to VDD but that made no particular change to the output signal.

    While trying this a few times, power cycling in-between, I saw the peak to peak voltage change to nearly 4.5 volts for a few moments. When this happened, valid, ungarbled data was transmitted to the BS2, and I saw live, good GPS data on the debug window for the first time. Then, as quickly as it came, the amplitude changed back to 3.0v and the uncorrupted data signal was lost. :-(

    I've managed to get it to work about 4 times now in the last hour. It runs for a minute or so when it works, and then drops back down to the 3.0v level and stops working again. I know it sounds weird. It's really happening. I'm just watching it on my scope as it happens.

    I _can_ post a picture of my setup, but I think I'll have to clean my desk a little bit so that I don't embarass myself.

    Another strange thing I noticed is that when the SIO amplitude is 3.0v peak to peak, the state of the /RAW pin has no impact on the data flow. The GPS module continues to dump data to the SIO pin regardless of whether or not the /RAW pin is tied high or not. When the peak to peak voltage is at 4.x volts (i.e. I'm getting good data), the /RAW pin functions like it's supposed to. So for example, if I just connect GPS module power + ground, and watch the SIO output on my scope, I'll see raw data pouring out, regardless of the state of the /RAW pin.

    I know, it's odd. But if it were acting normally, I wouldn't have to ask. smile.gif

    Rusty,

    For the PC experiment, I tied /RAW low so that I wouldn't have to send it any data. I connected it to a MAX233 level converter, then to the PC. Then I just watched it with HyperTerminal, and saw the correctly formatted raw strings.

    Regards,
    Joel-
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2006-10-07 04:12
    Ok - I just made a small break-through. I modified the demo program so that it would just send the raw data to the debug window. It did this just fine, even when the signal level was only 3.0v. So I've established that the amplitude of the SIO pin is a red-herring. The BS2 can read data at this voltage with no problem. However, the very interesting part is that I confirmed again that the /RAW pin has no impact on the stream of data emitted from the GPS module. It doesn't matter if it's tied high or low, it behaves as if it's tied low, and the module simply outputs a stream of data.

    So, the BS2 demo program gets confused because it's receiving a stream of data that it wasn't expecting. And eventually, when things work, the GPS module respects the /RAW signal and dumps data in smart mode only when the command string is received (like it is supposed to). And in this situation, the demo program works.

    So, I think the problem has now been reduced to figuring out why the /RAW input is being ignored by the GPS module. And then of course, why does it intermittently work now and again? There's not a lot going on with the wiring for the /RAW signal. I've left it unconnected and I've tied it high through a 10K resistor. It's simply ignored. And as I indicated above, the /RAW signal *does* do the right thing when the SIO output happens to be a 4.x volts.

    Thanks for the help so far!

    Joel-
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-10-07 04:25
    Joel,

    ·· Please contact our Tech Support Deptartment on Monday or send an e-mail to support@parallax.com and we'll get this taken care of.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Joel RosenzweigJoel Rosenzweig Posts: 52
    edited 2006-11-10 02:19
    Just wanted to follow up and say that Parallax exchanged my GPS module for another one, and the new module worked like it was supposed to.

    Joel-
Sign In or Register to comment.