Shop OBEX P1 Docs P2 Docs Learn Events
PMB-648 Advanced Questions — Parallax Forums

PMB-648 Advanced Questions

TodKTodK Posts: 4
edited 2012-11-10 05:26 in Accessories
I have a PMB-648 GPS unit which works great for me but I have some more advanced use questions is anyone can contribute.

1) I have seen documentation saying that the units can be put into "smart mode" where it answers queries to different elements in plain text answers. This is done by "pulling the RAW contact point down" but this example is shown on a slightly different chip package not the one sold with the plates and the wire attachment. Does the PBM-648 as sold by Parallax support "smart mode" and how do I trigger it? I see there are two exposed pads on the package marked "Boot" and "TP1" or "TPI" are either of these usable for that?

2) I'm using the Arduino and while the chip works great for receiving GPS signals I was hoping someone had advice on sending to the chip over Tx/Rx. I've tried some simple non-destructive Sirf commands using the Sirf format $PSRF103,05,00,01,01*20 from the console window but I don't see any acknowledgement from the unit - which might be normal but it's hard to tell if I'm actually communicating with it correctly.

3) Are there any vendor specific elements/commands to the this chipset that are addressable using $Pxxx where xxx is the vendor code and are these documented anywhere?

What I'm interested in doing is slowing the reporting from the unit for power management purposes. My applications are mostly long-distance hiking so I don't need reports every second and power management is more important than constant reporting. I'd like to be able to set it to report every minutes (or in increments of minutes) and sleep both the Arduino and GPS unit in between reports to save power. Ultimately I hope to incorporate an SD card for logging and LiPo with solar cell for indefinite logging but I need to be able to control my power consumption first.

If anyone has dug into this in depth I'd appreciate any input,

=Tod

Comments

  • PublisonPublison Posts: 12,366
    edited 2012-09-30 10:39
    TodK wrote: »
    I have a PMB-648 GPS unit which works great for me but I have some more advanced use questions is anyone can contribute.

    1) I have seen documentation saying that the units can be put into "smart mode" where it answers queries to different elements in plain text answers. This is done by "pulling the RAW contact point down" but this example is shown on a slightly different chip package not the one sold with the plates and the wire attachment. Does the PBM-648 as sold by Parallax support "smart mode" and how do I trigger it? I see there are two exposed pads on the package marked "Boot" and "TP1" or "TPI" are either of these usable for that?

    2) I'm using the Arduino and while the chip works great for receiving GPS signals I was hoping someone had advice on sending to the chip over Tx/Rx. I've tried some simple non-destructive Sirf commands using the Sirf format $PSRF103,05,00,01,01*20 from the console window but I don't see any acknowledgement from the unit - which might be normal but it's hard to tell if I'm actually communicating with it correctly.

    3) Are there any vendor specific elements/commands to the this chipset that are addressable using $Pxxx where xxx is the vendor code and are these documented anywhere?

    What I'm interested in doing is slowing the reporting from the unit for power management purposes. My applications are mostly long-distance hiking so I don't need reports every second and power management is more important than constant reporting. I'd like to be able to set it to report every minutes (or in increments of minutes) and sleep both the Arduino and GPS unit in between reports to save power. Ultimately I hope to incorporate an SD card for logging and LiPo with solar cell for indefinite logging but I need to be able to control my power consumption first.

    If anyone has dug into this in depth I'd appreciate any input,

    =Tod

    Hi Tod,

    Welcome to the forums!

    The PMB-648 GPS does not do RAW mode AFAIK. It's in Smart Mode all the time. Smart Mode just waits until you poll it. I would just do a timing loop to pull data down a a specific time.

    I don't do Arduino, so I can't offer any code.


    Jim
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-09-30 11:12
    The default mode of the PMB-648 is RAW, or plain NMEA serial output. The alternate mode is SiRF binary, which can be entered by sending a $PSRF command to the unit. In that mode you can modify the behavior of the unit. Here's a reference:

    I used this feature in some Spin code I wrote awhile back:
    CON
    
      _clkmode      = xtal1 + pll16x
      _xinfreq      = 5_000_000
    
    'SD Card pins:
    
      DO_PIN        = 22
      CLK_PIN       = 23
      DI_PIN        = 24
      nCS_PIN       = 25
    
    'Serial I/O pins:
    
      GPS_IN        = 16
      GPS_OUT       = 17
      PC_IN         = 31
      PC_OUT        = 30
    
    'Write indicator:
    
      LED_PIN       = 26
    
    'Unit ID:
    
      UNIT          = "0"
    
    'ASCII constants:
    
      CR            = 13
      LF            = 10
    
    OBJ
    
      sio   : "FullDuplexSerial"
      gps   : "FullDuplexSerial"
      sd    : "fsrw"
    
    PUB start | ch, i
    
      gps.start(GPS_IN, GPS_OUT, 0, 4800)
      sio.start(PC_IN, PC_OUT, 0, 9600)
      sd.mount_explicit(DO_PIN, CLK_PIN, DI_PIN, nCS_PIN)
      filename[7] := UNIT
      dira[26]~~
    
      waitcnt(cnt + clkfreq)
      gps.str(string("$PSRF100,0,4800,8,1,0*0F", CR, LF))   'Switch to SiRF binary protocol at 4800,8,N,1
       
      'Diable Static Navigation
      
      waitcnt(clkfreq + cnt)
      repeat i from 0 to 9
        gps.tx(DisStatNav[i])
       
      'Switch back To NMEA Protocol Message ID 129, leave only GGA and RMC strings and keep speed at 4800
      
      waitcnt(clkfreq / 2 + cnt)
      repeat i from 0 to 31
        gps.tx(BackToNMEA[i]) 
       
      repeat
        waitstr(string("$GPRMC,"))
        getstr(@time, 10)
        'if (time[5] == "0" or time[5] == "5")
          gps.rx
          if (gps.rx == "A")
            gps.rx
            getstr(@lat, 9)
            waitstr(string("N,"))                           'Change to "S" for southern hemisphere.
            getstr(@lon, 10)
            sio.str(@time)
            outa[26]~~                                      'Turn LED on during write, so it won't be interrupted by flipping off the power.
            sd.popen(@filename, "a")                        'Open the file to append data.
            sd.pwrite(@time, strsize(@time))                'Write the time and position line to the file.
            sd.pclose                                       'Do a close to stat the file.
            outa[26]~                                       'Turn off the LED.
          else
            sio.tx("*")
          
    PUB waitstr(strptr) | ptr, match
    
      ptr := strptr
      repeat while match := byte[ptr++]
        if (gps.rx <> match)
          ptr := strptr
    
    PUB getstr(strptr, len)
    
      repeat len
        byte[strptr++] := gps.rx
    
    DAT
    
    filename      byte      "gpsdata_.txt"
    time          byte      "dddddd.ddd,"
    lat           byte      "ddmm.mmmm,"
    lon           byte      "dddmm.mmmm",13,0
    
    'SiRF Disable Static Navigation, Message ID 143
    
    DisStatNav    byte      $A0,$A2,$00,$02,$8F,$00,$00,$8F,$B0,$B3
    
    'Switch back To NMEA Protocol Message ID 129 at 4800 bauds, leave on GGA and RMC strings updating oce per second.
    
    BackToNMEA    byte      $A0,$A2,$00,$18,$81,$02,$01,$01,$00,$01
                  byte      $00,$01,$00,$01,$01,$01,$00,$01,$00,$01
                  byte      $00,$01,$00,$01,$00,$01,$12,$C0,$01,$61
                  byte      $B0, $B3  
    

    Maybe this will help you get started.

    -Phil
  • PublisonPublison Posts: 12,366
    edited 2012-09-30 11:32
    Of course Phil is correct. I pulled up the wrong Data Sheet.
  • TodKTodK Posts: 4
    edited 2012-09-30 14:47
    Wow, thanks, that's all good stuff.

    Does the chip have any onboard power or report management controls that you know of? I think I may need to settle for sleeping the Arduino unit only and living with the 65mA draw of the GPS chip.

    My (very) rough estimation 3 AAAs should support about 17 hours of 65mA and 3 AAs should 32 hours of 65mA draw. Is that correct?

    Thanks again,

    -Tod
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-09-30 15:13
    The SiRF manual mentions an Advanced Power Management setting. You could try it with the PMB-648 and see if it does anything.

    -Phil
  • max72max72 Posts: 1,155
    edited 2012-10-01 07:36
    Welcome to the forum.
    I searched the web in the past for low power mode with Sirf units, and when you access in sirf binary mode you should be able to go to low power.
    I guess this should apply also to your unit.
    I have not tested it yet (my GPS unit is around at the moment..), but from the web search it is not a sleep mode, but a kind of intermittent mode, where the clock and the fixing is still available, at a lower rate. In fact at startup you will have full consumption till clock and almanac sync (and fixing, but I'm not sure), then the unit will drift to a lower consumption.
    Let us know your findings.
    Massimo
  • softconsoftcon Posts: 217
    edited 2012-10-01 10:35
    Where in the world did you find out how to configure this thing.
    The parallax document linked to in the store has minimal documentation, and although the code samples help, they don't touch at all on configuration, rtc usage, or the battery backed configuration options. I have other questions on this unit I was just logging in to ask, and saw this thread, so I'll create a new thread for those, but I'm very interested in finding out more about this little unit, and what it can be made to do. I've hunted around, and found documentation on the nmea0183 protocol it uses (though it doesn't seem to follow the standard completely) but I didn't find anything at all about it's configuration options. Glad you located them, I'll be taking a look at that document, and see what it tells me about this topic.
  • TodKTodK Posts: 4
    edited 2012-10-01 21:18
    So a report of progress so far. I tried writing some settings with some success and with some error string reporting which, while technically a failure, gave some good feedback that the chip was hearing me and responding.

    So I found a tutorial with someone using the PMB-648 for a specific project so I felt safe lifting his command strings and trying them out. Specifically:

    Serial.write("$PSRF103,2,0,0,1*02\r\n"); // Disables GPGSA sentence


    This line suppressed the output of the $GPGSA line as advertised. I've seen some of the official NMEA documentation but it doesn't cover the commands below 150 or so, but I found this reference that does: http://gpsd.berlios.de/vendor-docs/sirf/SiRF2-Leadtek.pdf

    So I determined that the command to reverse the above command meant changing a byte: $PSRF103,2,00,01,01*02\r\n but the chip kicked back an error about the checksum being wrong.So I needed to find the correct Here is an on-line script that will generate checksums for NMEA strings... brilliant!
    http://www.hhhh.org/wiml/proj/nmeaxor.html

    Serial.write("$PSRF103,2,00,01,01*17\r\n");// Enables GPGSA sentence

    I haven't gotten into power management yet but frequency of reporting is next.

    Project link: http://www.designspark.com/files/ds/CK78764_Complete_Documentation_0.pdf (actually a cool project, props!)

    Just reporting back to perhaps help others in the future.

    Thanks everyone,
    =Tod

    PS All code is Arduino based.
  • TodKTodK Posts: 4
    edited 2012-10-06 13:46
    I just wanted to check in with a last update with my progress.

    Using the documentation on $PSRF103 command I was able to suppress any signals I don't want by change the timing of reporting to 0 and change the timing for strings I do want from 1 - 255 seconds. I don't know if changing the timing of the chip to every 60 seconds would actually reduce the power draw in any significant way but makes programming the use cases I'm interested in easier.

    After getting that working I wanted to see about sleeping the Arduino unit to save power and I realized that it would be easier to have the unit respond to polling than trying to time waking the Arduino unit to coincide with the GPS unit timing. I was able to get this working by suppressing all the messages and then using the $PSRF103 command to poll the specific data strings I as interested in.

    Serial.write("$PSRF103,2,1,1,1*26\r\n");// Polls GPGSA sentence

    The final set-up is starting everything, suppressing all the strings, sleeping the Arduino unit until wakes, polls the GPS, logs the data and then sleeps again.

    Another data point is that the PMB-604 package contains a rechargeable battery. As it turns out I didn't have the unit plugged in for 4 or 5 days and all the commands I sent to suppress the messages had worn off and it was back to default settings. It might hold a charge longer if the unit is plugged in longer but it seems like it will always revert if it is removed from power long enough. You would probably want to program for that possibility in long term situations.

    I haven't played with actual power management since I can't find any examples and I'm kind of afraid of bricking my GPS unit, but it seems like the internal settings will return to normal eventually. There is pad labeled 'boot' on the edge of the package - I don't know if this could possibly be used to reset the factory settings or not.

    This probably my last update unless I actually play with the power settings and get any kind of dependable result. I fell like I've done about as much as I can with the 103 commands and I know what's possible and I'm not sure I want experiment with the complex looking power management commands without any clear guidance.

    Thanks to everyone who contributed,
    =Tod
  • geometrixgeometrix Posts: 27
    edited 2012-11-09 19:39
    Dear Phil,

    I want to disable static navigation(ID 143). After I do this, do I have to Switch To NMEA Protocol (ID 129)?

    Once I do this, will these settings be saved on a power down? Or do I need to re-configure with every power up?

    TIA
    --Neal
    The default mode of the PMB-648 is RAW, or plain NMEA serial output. The alternate mode is SiRF binary, which can be entered by sending a $PSRF command to the unit. In that mode you can modify the behavior of the unit. Here's a reference:

    I used this feature in some Spin code I wrote awhile back:
    CON
    
      _clkmode      = xtal1 + pll16x
      _xinfreq      = 5_000_000
    
    'SD Card pins:
    
      DO_PIN        = 22
      CLK_PIN       = 23
      DI_PIN        = 24
      nCS_PIN       = 25
    
    'Serial I/O pins:
    
      GPS_IN        = 16
      GPS_OUT       = 17
      PC_IN         = 31
      PC_OUT        = 30
    
    'Write indicator:
    
      LED_PIN       = 26
    
    'Unit ID:
    
      UNIT          = "0"
    
    'ASCII constants:
    
      CR            = 13
      LF            = 10
    
    OBJ
    
      sio   : "FullDuplexSerial"
      gps   : "FullDuplexSerial"
      sd    : "fsrw"
    
    PUB start | ch, i
    
      gps.start(GPS_IN, GPS_OUT, 0, 4800)
      sio.start(PC_IN, PC_OUT, 0, 9600)
      sd.mount_explicit(DO_PIN, CLK_PIN, DI_PIN, nCS_PIN)
      filename[7] := UNIT
      dira[26]~~
    
      waitcnt(cnt + clkfreq)
      gps.str(string("$PSRF100,0,4800,8,1,0*0F", CR, LF))   'Switch to SiRF binary protocol at 4800,8,N,1
       
      'Diable Static Navigation
      
      waitcnt(clkfreq + cnt)
      repeat i from 0 to 9
        gps.tx(DisStatNav[i])
       
      'Switch back To NMEA Protocol Message ID 129, leave only GGA and RMC strings and keep speed at 4800
      
      waitcnt(clkfreq / 2 + cnt)
      repeat i from 0 to 31
        gps.tx(BackToNMEA[i]) 
       
      repeat
        waitstr(string("$GPRMC,"))
        getstr(@time, 10)
        'if (time[5] == "0" or time[5] == "5")
          gps.rx
          if (gps.rx == "A")
            gps.rx
            getstr(@lat, 9)
            waitstr(string("N,"))                           'Change to "S" for southern hemisphere.
            getstr(@lon, 10)
            sio.str(@time)
            outa[26]~~                                      'Turn LED on during write, so it won't be interrupted by flipping off the power.
            sd.popen(@filename, "a")                        'Open the file to append data.
            sd.pwrite(@time, strsize(@time))                'Write the time and position line to the file.
            sd.pclose                                       'Do a close to stat the file.
            outa[26]~                                       'Turn off the LED.
          else
            sio.tx("*")
          
    PUB waitstr(strptr) | ptr, match
    
      ptr := strptr
      repeat while match := byte[ptr++]
        if (gps.rx <> match)
          ptr := strptr
    
    PUB getstr(strptr, len)
    
      repeat len
        byte[strptr++] := gps.rx
    
    DAT
    
    filename      byte      "gpsdata_.txt"
    time          byte      "dddddd.ddd,"
    lat           byte      "ddmm.mmmm,"
    lon           byte      "dddmm.mmmm",13,0
    
    'SiRF Disable Static Navigation, Message ID 143
    
    DisStatNav    byte      $A0,$A2,$00,$02,$8F,$00,$00,$8F,$B0,$B3
    
    'Switch back To NMEA Protocol Message ID 129 at 4800 bauds, leave on GGA and RMC strings updating oce per second.
    
    BackToNMEA    byte      $A0,$A2,$00,$18,$81,$02,$01,$01,$00,$01
                  byte      $00,$01,$00,$01,$01,$01,$00,$01,$00,$01
                  byte      $00,$01,$00,$01,$00,$01,$12,$C0,$01,$61
                  byte      $B0, $B3  
    

    Maybe this will help you get started.

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-11-09 19:46
    geometrix wrote:
    I want to disable static navigation(ID 143). After I do this, do I have to Switch To NMEA Protocol (ID 129)?
    Mabye not, if there's a way to get the nav info you need in the other protocol. But it seems to me that NMEA would be much easier to deal with, since it's ASCII-based.
    Once I do this, will these settings be saved on a power down? Or do I need to re-configure with every power up?
    I'm not sure, but I think it depends upon how long you're powered down. That being the case, I would recommend reconfiguring on every power-up.

    -Phil
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-11-10 05:26
    I'm not sure, but I think it depends upon how long you're powered down. That being the case, I would recommend reconfiguring on every power-up.

    Gosh, I sure wish I'd said that.
    Oh, wait, I did.
Sign In or Register to comment.