Shop OBEX P1 Docs P2 Docs Learn Events
GPS Module; Prop Demo Board Questions — Parallax Forums

GPS Module; Prop Demo Board Questions

mre_robmre_rob Posts: 31
edited 2007-05-30 21:56 in Propeller 1
I am in the process of stating my first Propeller project. I am new to Spin, but have tons of programming experience interfacing with devices and building device drivers.

Connecting GPS·SIO to P0 thru a 1k resistor, GPS Vcc to 5V and GPS Gnd & /raw·to Vss

with the following spin code:

<code>
OBJ
· vga:"VGA_Text"
· Serial· : "Simple_Serial"
CON
······· _clkmode······· = xtal1 + pll16x
······· _xinfreq······· = 5_000_000

VAR
· long rx, tx, baud
· long x
· byte b
······
Pub Start
··· Serial.start(0,-1,9600)
··· vga.start(16)
··· b:=$0D
··· repeat
····· x:=Serial.rx
····· vga.str(string("Data: "))
····· vga.out(x)
····· vga.out(b)·
</code>

I get no output. When I comment out - 'x:=Serial.rx, I get "Data: " printed on the VGA display.

I basically just need the raw stream for later processing in other objects.

Any direction would be appreciated, until then I'll keep reading....


Thanks,
Rob.

Post Edited (mre_rob) : 5/11/2007 1:22:07 AM GMT

Comments

  • fishfish Posts: 55
    edited 2007-05-11 01:32
    Hi Rob,
    The baud rate for the Parallax·gps module is 4800 I believe, so try that and see if you get anything.

    Good luck
    fish
  • AribaAriba Posts: 2,682
    edited 2007-05-11 05:50
    Try to use FullDuplexSerial instead of Simple_Serial. I had some problems with receiving, when I tested the Simple_serial.
    If you only use Simple_Serial because you can switch off the Transmitter, then you can also use my SerialReceive (appended).
    It is just a half FullDuplexSerial, extended by a 9 Bit mode.

    Andy
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-11 19:35
    Rob,

    Please see the following thread. I posted some sample code to interface to the GPS Module within the thread. I hope this helps. Take care.

    http://forums.parallax.com/showthread.php?p=636124

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • mre_robmre_rob Posts: 31
    edited 2007-05-12 11:19
    Chris Savage (Parallax) said...
    Rob,

    Please see the following thread. I posted some sample code to interface to the GPS Module within the thread. I hope this helps. Take care.

    http://forums.parallax.com/showthread.php?p=636124

    Chris,
    Thanks for the direction. I had already reviewed that thread and it was the starting point for my proj.

    Thanks for the reply.
  • mre_robmre_rob Posts: 31
    edited 2007-05-12 11:20
    fish said...
    Hi Rob,
    The baud rate for the Parallax·gps module is 4800 I believe, so try that and see if you get anything.

    Good luck
    fish
    ···· Thanks Fish.. I saw that mistake and now pulling a byte· at a time.....
  • mre_robmre_rob Posts: 31
    edited 2007-05-12 11:24
    Ariba said...
    Try to use FullDuplexSerial instead of Simple_Serial. I had some problems with receiving, when I tested the Simple_serial.
    If you only use Simple_Serial because you can switch off the Transmitter, then you can also use my SerialReceive (appended).
    It is just a half FullDuplexSerial, extended by a 9 Bit mode.

    Andy
    Thanks for the pointer... I will integrate this into my app.
  • mre_robmre_rob Posts: 31
    edited 2007-05-12 11:52
    I'm still missing somehting... in other platforms I have worked with, there is a way to get the entire sentence of data then parse it. I am not totally understanding how to do this in the Spin world.

    I am looking to pull the GPRMC sentence and parse into it's parts for later processing. I see that Mirror's Serial mod has different sized buffers I can utilize, but I am not sure how to pull the buffer.... I rx methods for getting a byte at a time, which is what I am currently doing, but I see no "rx stream" rx method.

    Am I headed down the wrong path? Do I need to implement a method to pull a byte at a time and buffer it myself, then send it to a parser when I have a completed sentence?

    Also, using the demo board's vga out as my debugger, how can I display the full sentence - once I get it. Displaying strings is easy, but I see no methods to display or dump a buffer (array of bytes) to the screen in a meaningful message that is easily read by a human....

    TIA for input....
  • LeonLeon Posts: 7,620
    edited 2007-05-12 18:34
    mre_rob said...
    I'm still missing somehting... in other platforms I have worked with, there is a way to get the entire sentence of data then parse it. I am not totally understanding how to do this in the Spin world.

    I am looking to pull the GPRMC sentence and parse into it's parts for later processing. I see that Mirror's Serial mod has different sized buffers I can utilize, but I am not sure how to pull the buffer.... I rx methods for getting a byte at a time, which is what I am currently doing, but I see no "rx stream" rx method.

    Am I headed down the wrong path? Do I need to implement a method to pull a byte at a time and buffer it myself, then send it to a parser when I have a completed sentence?

    Also, using the demo board's vga out as my debugger, how can I display the full sentence - once I get it. Displaying strings is easy, but I see no methods to display or dump a buffer (array of bytes) to the screen in a meaningful message that is easily read by a human....

    TIA for input....
    The way I've done it in assembler with a PIC16F88 and a uBlox module is to read bytes until I detect, say, $GPMRC, and then save the rest of the sentence in a buffer. When it's in the buffer I extract the relevant items.

    Leon


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • DroneDrone Posts: 433
    edited 2007-05-13 01:23
    Mre_Rob,

    Use the Extended_FDSerial.spin object by Martin Hebel which I think is available on the Object Exchange or do a search). Extended_FDSerial.spin requires the ubiquitous FullDuplexSerial.spin object. Extended_FDSerial is quite useful.

    To get the $GPRMC sentence start a repeat loop and test for the presence (or non-presence) of the "$" character - the start of sentence delimiter, when "$" is detected, then use someting like .RxStr(@array1)... or .RxStrTime(1,@array)... method to receive each comma delimited field in the sentence (see the Extended_FDSerial documentation); remember to define array1, array2, etc., one for each field under VAR as "byte array1[noparse][[/noparse]10]"... and have each array size big enough to hold the field received. Remember to set your delimiter or ",". In the end, you will have a series of arrays (array1, array2, etc.) each containing the one comma delimited field that makes up the $GPRMC sentence. Extended_FDSerial.spin has additional methods to parse and process such data too.

    I've seen this done at least once somewhere in Prop forum - have a search. I only have time for a quick reply this morning.
  • mre_robmre_rob Posts: 31
    edited 2007-05-13 12:28
    Drone said...
    Mre_Rob,

    Use the Extended_FDSerial.spin object by Martin Hebel which I think is available on the Object Exchange or do a search). Extended_FDSerial.spin requires the ubiquitous FullDuplexSerial.spin object. Extended_FDSerial is quite useful.

    To get the $GPRMC sentence start a repeat loop and test for the presence (or non-presence) of the "$" character - the start of sentence delimiter, when "$" is detected, then use someting like .RxStr(@array1)... or .RxStrTime(1,@array)... method to receive each comma delimited field in the sentence (see the Extended_FDSerial documentation); remember to define array1, array2, etc., one for each field under VAR as "byte array1[noparse][[/noparse]10]"... and have each array size big enough to hold the field received. Remember to set your delimiter or ",". In the end, you will have a series of arrays (array1, array2, etc.) each containing the one comma delimited field that makes up the $GPRMC sentence. Extended_FDSerial.spin has additional methods to parse and process such data too.

    I've seen this done at least once somewhere in Prop forum - have a search. I only have time for a quick reply this morning.
    I will give that a shot... It looks like I am in a symantic mis-understanding.... after trying to decipher the code and with your comments it looks like I am getting some understanding....finally...

    Thanks for all of the help...
  • mre_robmre_rob Posts: 31
    edited 2007-05-14 10:38
    Got it... the buffer might be a little big... still working on parsing but here is the method that gets the entire sentence:

    <code>
    Pri GetSentence(strPtr) | ptr, haveFoundDelimiter, rxChar, delimiter
    delimiter:="$"
    ptr:=0
    haveFoundDelimiter~
    bytefill(@serialBuffer,0,256)
    repeat while !haveFoundDelimiter
    if (rxChar:=objSerial.rxcheck)=>0
    if(rxChar==delimiter)
    serialBuffer[noparse][[/noparse]ptr] := objSerial.rx
    ptr++
    repeat while ((serialBuffer[noparse][[/noparse]ptr-1] <> 13) and (serialBuffer[noparse][[/noparse]ptr-1] <> delimiter)) and (ptr < 255)
    serialBuffer[noparse][[/noparse]ptr] := objSerial.rx
    ptr++
    haveFoundDelimiter~~
    serialBuffer[noparse][[/noparse]ptr-1]:=0
    byteMove(strPtr,@serialBuffer,256)
    </code>

    Thanks to all who helped!! I'll post the complete code when done!!
  • DroneDrone Posts: 433
    edited 2007-05-15 01:34
    mre_Rob,

    Your buffer size should not be a problem with $GPRMC as I think the fields are always less than sixteen bytes between comma delimiters (FullDuplexSerial's buffers are 16 bytes). However, there is a modification to FullDuplexSerial called SerialMirror by mirror (see http://forums.parallax.com/forums/default.aspx?f=25&m=189806) that has enhanced FullDuplexSerial somewhat and increased the buffer to 64 bytes. SerialMirror may or may not help you, personnally I haven't tried it. I attach the file serialmirror.spin just in-case the link above is wrong. I have also seen some discussions about expanding the buffers in FullDuplexSerial natively somewhere on the forum - didn't seem too difficult, but if memory serves (and it often doesn't) there had to be some poking around in the assembly language part.

    Good Luck, Drone

    Post Edited (Drone) : 5/15/2007 1:39:42 AM GMT
  • mirrormirror Posts: 322
    edited 2007-05-15 04:32
    Drone, gosh I'm flattered - attaching my code, thanks. I wasn't even reading the thread in much detail.

    I wrote an earlier variation on FullDuplexSerial called . . . umm, err FullDuplexSerial.·It's an almost·functional drop-in for the original, just two changes:

    1) detection of stop bit

    2) easily vary the·buffer sizes.

    The thread's at http://forums.parallax.com/showthread.php?p=644816

    SerialMirror is a bit different - but the code includes comments as to when you can use it, and when to use FullDuplexSerial.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    It's not all that hard to count the number of grains of sand on the beach. The hardest part is making a start - after that it just takes time.·· Mirror - 15 May 2007
  • mre_robmre_rob Posts: 31
    edited 2007-05-15 10:21
    Thanks Drone and Mirror.... I did see those posts and utilized Mirror's buffering concept. I really appreciate everyone's help here. Once I am past the noob stage, I will hope to be as much help to others as you guys are....
  • M. K. BorriM. K. Borri Posts: 279
    edited 2007-05-15 14:36
    mre_rob, you can also try the modified SimpleSerial and FullDuplexSerial that are in my project's source archive -- I had more or less the same problem (using a garmin etrex gps, too, which has horrendous timing). My solution is a bit hackish but works.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    http://forums.parallax.com/showthread.php?p=650217

    meow, i have my own topic now? (sorta)
  • TheodoreTheodore Posts: 5
    edited 2007-05-28 03:00
    Hey guys, im new to this thread and to the forums actually, so please bear with my "amatuerness." I too have the parallax GPS and have had some issues.


    First off i started with the idea that the GPS module was 2 stop bits, i recently checked the PDF file and it says 1 stop bit. Maybe they came out with a new revision? To test it i hooked it up to my computer serial port via RS-232 level shifter and tried 4800 baud with 1 stop bit and 2. Both worked!? can someone please explain this to me.

    Then tried the GPS board on my the PJRC 8051 dev board in smart mode. I tried the smart mode for the reasons of being easier to use. I connected VCC-5V GND - Vss /RAW - UNCONNECTED and had the same dilemma you guys previously discussed about how to connect the SIO. I tried devising schematics for connecting my dev boards seperate Tx and Rx pins to the single SIO, i saw the schematic with the 2 resisters on each line. Can someone explain 2 me the electronics behind the schematic attached. wont the Tx signal go through both the SIO and the Rx, even through theres another resister.
    905 x 384 - 24K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-29 15:45
    Theodore,

    See the following thread…3rd message from the bottom outlines connection and code. Take care.

    http://forums.parallax.com/showthread.php?p=636124

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • TheodoreTheodore Posts: 5
    edited 2007-05-29 22:06
    I am sorry for not being clear. My problem is that i have to use seperate Tx and Rx pins on my microcontroller. I cant use an I/O for a serial port and switch it form and output to and input. I have to use my aux RS232 port. I installed a level shifter, but i still need to figure out a way to connect it all.

    Can someone please explain how the schematic below works with seperate Tx and Rx lines
    905 x 384 - 24K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-30 03:43
    Theodore,

    If you’re not using a Propeller then this isn’t the correct forum for this post. If you are then the information I posted would be very useful. Are you using a Propeller?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • TheodoreTheodore Posts: 5
    edited 2007-05-30 13:11
    Yes and no.
    Yes in that i have the prop demo board an plan to utilize it

    No i that first i wish to integrate my other microcontroller. Im not asking fo support on my microcontroller but on how to connect the Parallax GPS module· to a standard TTL RS232 port with seperate Tx·and Rx lines·in smart mode
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-30 16:27
    Since this thread is related to GPS/Prop Demo Board I would suggest starting a new thread in the Sandbox on your other controller. The only interface information available for RS-232 connection does not include the GPS since it cannot be interfaced in this manner. Take care.

    http://forums.parallax.com/showthread.php?p=640507

    P.S. - RS232 and TTL Serial are two different signal levels.· For TTL no MAX232 chip is required as shown in the schematic.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • TheodoreTheodore Posts: 5
    edited 2007-05-30 21:56
    sorry about that and thank you. Im new to the forum so i dont really know the rules yet.
Sign In or Register to comment.