GPS Module; Prop Demo Board Questions
mre_rob
Posts: 31
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
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
The baud rate for the Parallax·gps module is 4800 I believe, so try that and see if you get anything.
Good luck
fish
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
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
Thanks for the direction. I had already reviewed that thread and it was the starting point for my proj.
Thanks for the reply.
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....
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
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.
Thanks for all of the help...
<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!!
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
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
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://forums.parallax.com/showthread.php?p=650217
meow, i have my own topic now? (sorta)
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.
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
Can someone please explain how the schematic below works with seperate Tx and Rx lines
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
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
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