Shop OBEX P1 Docs P2 Docs Learn Events
BS2px and GPS Module — Parallax Forums

BS2px and GPS Module

SPolySPoly Posts: 20
edited 2011-10-12 02:50 in BASIC Stamp
Hi guys,

Basically i need a list of the baud rate settings to use when i am using a BS2px and a Parallax GPS Receiver Module. Basically I have problem running the problem as i cannot match the baud rate.
So far i managed to get this for the stamp
T9600······ CON···· 396
T19K2······ CON···· 188

But how do i adjust the GPS baud rate to have the same values?
Baud CON 396 ' Serial Baud Rate 9600 bps (BS2)
GPSBaud CON 17197 ' 4800 Baud

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-11 09:52
    There's a link to the BASIC Stamp 2px Brief on this webpage. The Brief has all the BS2px-specific information.
  • SPolySPoly Posts: 20
    edited 2011-10-11 10:24
    Hi Mike,

    I have change it accordingly, but it seems that the GPS would not work.But if i were to change to a BS2p it would work fine.
    I have a high suspicion it has to do with incorrect baud rate. Any help?
  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-11 11:04
    The BS2p and BS2px use different Baud constants. For the Baud used by the GPS Receiver, you need true mode at 4800 Baud. The constant for the BS2px (from the Brief) is 813. The I/O has to be open mode (open-drain), so you have to add $8000 (32768). Look at the examples for the GPS Receiver to see how the $8000 is used.

    If you need more help than the above, you'll need to draw up a schematic of your setup and attach both the schematic and your source program to a reply explaining what you mean by "would not work". The sample GPS programs should work with a BS2px by just changing the Baud constant. If it doesn't work for you, then there must be something else going on with your situation.
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-10-11 11:05
    If you have one of the older Parallax GPS receiver modules, they only communicate at 4800 Baud. The newer GPS is powered by a Propeller and runs at 9600 Baud. Which ever you have, the Basic Stamp must be set to the same Baud rate.

    In the PBasic Editor Help file, if you go to the "PBasic Language Reference" section, you will find a list of PBasic commands, click on SEROUT and it will take you to lots of info about that command.

    There is a section where it explains how to calculate that number to use for CON for every possible Baud mode for any type of Stamp. This is good to know because none of the tables that are shown go higher than 9600 Baud.
  • SPolySPoly Posts: 20
    edited 2011-10-11 11:43
    I tried changing by referring to all the above mentioned methods but to no avail. Basically the problem i have here is that, usually when the debug terminal says "Waiting for GPS signal..." and after that i would press button 1, the program would start datalogging. But now it does not start the datalogging. Anyway, on the debug terminal it states that the baud rate is 19200, but didnt i just change it to 9600?
    Baud CON 396 ' Serial Baud Rate 9600 bps (BS2px)
    GPSBaud CON 33164 ' 9600 Baud (Open Mode)

    Also if i were to put the BAUD CON to 4800 baud rate, the program will just keep on looping at the initialization part.
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-10-11 13:55
    Assuming (which is sometimes a bad idea) that you have the #28146 GPS receiver and are using some version of the demo code, for the BS2px to communicate with the 4800 Baud GPS receiver these Constants should be in the code:
    T4800     CON     813
    Open      CON     $8000
    Baud      CON     Open | T4800    ' Open mode to allow daisy chaining
    

    Then your SEROUT commands to the GPS should look something like this:
    SEROUT Sio, Baud, ["!GPS", GetTime]
    

    Don't confuse the Baud rate of the DEBUG terminal with the GPS, they are two different things.

    If this doesn't work, you need to tell us exactly which GPS you're using and post the code also.
  • PublisonPublison Posts: 12,366
    edited 2011-10-11 16:57
    As Rick said...you should post the code that you are using and the part # of the Parallax GPS device.

    You need to have a solid LED on the GPS, (not blinking), indicating that you have satellite lock. Normally you can not get a good lock indoors.

    Jim
  • SPolySPoly Posts: 20
    edited 2011-10-11 20:36
    Yes i am using the #28146 GPS receiver module. Here is my code which i have changed accordingly to your teaching.
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-10-11 21:08
    Do you also have the Memory Stick Datalogger ? That's what the code you attached is made to work with. If that's the case, ignore what I posted before because that was for the GPS demo code. However, you might want to try and run that code first, just to be sure your GPS module is working right.

    To get the GPS_Datalogger.bs2 code to work for the BS2px I think you just need to change:
    Baud            CON     84              ' Serial Baud Rate 9600 bps (BS2)
    GPSBaud         CON     32956           ' 4800 Baud (Open Mode)
    

    To this:
    Baud            CON     396            ' Serial Baud Rate 9600 bps (BS2px)
    GPSBaud         CON     33581          ' 4800 Baud (Open Mode, BS2px)
    

    Baud is what's used for Stamp to Datalogger communication, GPSBaud is for Stamp to GPS communication.

    Remember, the GPS usually won't work indoors unless it's near a window. If the red LED is blinking it means it hasn't got enough satellites locked to work correctly.
  • SPolySPoly Posts: 20
    edited 2011-10-11 21:22
    Yes i do have the datalogger also. I tried your method but still it wont work. As mentioned before, if i were to change to a BS2 it would work fine and the red LED would light up. But in the case of BS2px, the LED doesn't appear. Also does it have anything to do with the debug terminal baud setting. As mine is showing Baud Rate 19200 Parity None Data Bits 8 Flow control OFF
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-10-11 23:46
    No, the Debug terminal has nothing to do with it.

    If the LED on the GPS doesn't light up at all then you have some problem other than changing from a BS2 to a BS2px. The GPS will function without any Stamp at all, as long as it has power and ground connected. I would double check all wiring and then try to get the GPS working with just the GPS demo code.
  • SPolySPoly Posts: 20
    edited 2011-10-12 02:50
    Okay guys, I" give it a try :) Thanks
Sign In or Register to comment.