Talking to the Magnavox: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
Line 84: Line 84:
==Spying on the serial port==
==Spying on the serial port==


I installed interceptty on my Linux server. I run it with this command line.
I installed [[interceptty]] on my Linux server. I run it with this command line.
This will create a named pipe /tmp/ttyS0 that vmware will think is the real serial port. This allows me to spy on the serial protocol used by the CDU311 MSDOS program that came with the receiver.
This will create a named pipe /tmp/ttyS0 that vmware will think is the real serial port. This allows me to spy on the serial protocol used by the CDU311 MSDOS program that came with the receiver.



Revision as of 22:34, 23 June 2006

NMEA from the Magnavox

NMEA strings are pouring in at 9600 bps on the serial port; I can see them in a minicom window. It looks like a NMEA message comes in once per second.

I tried to use gpsd[1], a dandy program, but it is designed to provide a stream of time and location data in a simple format. For my purposes I want to be able to both control the Magnavox (which unlike your $99 GPS has no front panel) and to read all the data it can generate, including things like the almanac, the satellite positions, the differential data stream and so on.

Each of the strings is prefixed with $PMVXG,code, where code is a 3-digit integer padded leading zeroes. There are about 50 codes defined. Here is a sample of the output.

$PMVXG,015,0000000,0000,1,,*61                                                  
$PMVXG,052,  3.4515,*57                                                         
$PMVXG,100,05,10,052,38,47,,,,D5,  + ,-000.871,,,*05                            
$PMVXG,100,06,29,103,19,45,,,,71,  + ,0003.445,,,*6A                            
$PMVXG,100,07,30,190,25,45,,,,92,  + ,0000.011,,,*6D                            
$PMVXG,100,08,00,,,,,,,*6D                                                      
$PMVXG,000,NAV,11,9,0000,0*34                                                   
$PMVXG,036,032708,5539.86934,N,10942.90202,W,????????,000000,343634,0*7E        
$PMVXG,023,032709,4432.72623,N,12315.75804,W,00055.40,333.0,000.0,03,032708,03,C
$PMVXG,022,098828.00,00.5,00.7,01.5,15,00,21,06,10,29,30,00,26,00,16,18*7F      
$PMVXG,052,  3.4514,*56                                                         
$PMVXG,100,09,26,118,13,42,,,,77,  + ,0003.917,,,*61                            
$PMVXG,100,10,02,072,00,00,,,,82,SRCH,,,,*7F                                    
$PMVXG,100,11,16,315,21,44,,,,03,  + ,0000.257,,,*6C                            
$PMVXG,100,12,18,197,23,46,,,,A3,  + ,0002.088,,,*1A                            
$PMVXG,000,NAV,11,9,0000,0*34                                                   
$PMVXG,023,032710,4432.72623,N,12315.75805,W,00055.40,002.5,000.0,03,032709,03,0
$PMVXG,052,  3.4513,*51                                                         
$PMVXG,000,NAV,11,9,0000,0*34                                                   
$PMVXG,023,032711,4432.72623,N,12315.75805,W,00055.39,202.4,000.0,03,032710,03,4
$PMVXG,052,  3.4512,*50                                                         
$PMVXG,533,14,11,2005,,,*4F

Fields are comma-separated, and the last part (eg *4f) is a checksum field. (When present, the checksum is delimited by the *, not by a comma!) You don't have to send checksum, it's optional, just leave it off when sending commands.

000 Receiver status: It's in Navigation mode, 11 satellites should be visible, it's tracking 9, time since last navigation: 0, and its wating for initialization.
015 RCm input port statistics
022 Nav constellation
023 Position, height, COG and SOG
036 Self survey results
052 Oscillator offset (?) (something I have been longing to know...)
100 GPS Channel status
101 Control sentence accept/reject: 0 = accepted
533 GPS date

Initialization

I think the 000 message means that I need to send it an initialization command to make it happy. The 000 command sets its known position, and the 001 command sets some constants and limits. Since I am in navigation mode, I don't need to give it position.

Sending commands to the box

You can ask the box to send a sentence with command $PMVXG,YYY where YYY is the Magnavox code or NMEA string prefix. Commands are terminated with CRLF. (return key followed by control-j)

Example: $PMVXG,GPQ
Response: $PMVXG,101,GPQ,6,01,E*76  6 = requested sentence unavailable
Example: $PMVXG,037
Response: $PMVXG,101,037,3,,*4F     3 =  unrecognized id                                                          
Example: $PMVXG,003
Response: $PMVXG,101,037,3,,*4F     3 =  unrecognized id                                                          

Stop sending the date (block 533): $PMVXG,007,533,,2,,,,,
Send date once every 10 seconds: $PMVXG,007,533,,1,,10,,,

Start sending lat-lon (GLL) strings to control port: $PMVXG,007,GLL,,1,,1,,,
Stop sending GLL: $PMVXG,007,GLL,,2,,,,,

Start sending position (GGA) strings to control port: $PMVXG,007,GGA,,1,,1,,,
Stop sending GGA: $PMVXG,007,GGA,,2,,,,,

Start sending velocity/track over ground (VTG) strings to control port: $PMVXG,007,VTG,,1,,1,,,
Stop sending VTG: $PMVXG,007,VTG,,2,,,,,
(Not much point in using this when the station is parked on my office floor.)

Set in NAV mode: $PMVXG,035,0,,,
Set in COR REF mode: $PMVXG,035,1,,,

Spying on the serial port

I installed interceptty on my Linux server. I run it with this command line. This will create a named pipe /tmp/ttyS0 that vmware will think is the real serial port. This allows me to spy on the serial protocol used by the CDU311 MSDOS program that came with the receiver.

interceptty -s 'ispeed 9600 ospeed 9600' /dev/ttyS0 @/tmp/ttyS0

I set up a copy of the new "vmware player" to run an MS-DOS virtual machine, and I have the machine boot from a floppy disk image. This is a small and simple way to get my Linux box to run the Magnavox control program.

It is important to plug the right cable in from the Magnavox. :-) One outputs NMEA, the other, raw data.

A few resources

[http: gpsd] a daemon that reads nmea data
Python GPS project
Python serial library