pa1010d-python
                                
                                
                                
                                    pa1010d-python copied to clipboard
                            
                            
                            
                        pps.py example seems to send incorrect commands
It seems that the pps.py example, sends "PMTK255,1" for on.
But this seems to be to send the device into periodic backup mode
Quote from: https://cdn.shopify.com/s/files/1/0174/1800/files/CD_PA1010D_Datasheet_v.03.pdf?v=1602073146
- Enter periodic mode by sending the following command:
 
$PMTK225,Type, Run_time, Sleep_time,2nd_Run_time,2nd_Sleep_time*checksum
Where:  Type = 1: Periodic backup mode, Type = 2 : Periodic standby mode
And sends "PMTK255,0" for off
But
- To return to Full Power mode (from a low power mode), send the following command: $PMTK225,0*2B (the module will wakes up from its previous sleep cycle).
 
... this seems to match what I see on my PA1010D GPS Breakout by Pimoroni
It kinda does shut off the PPS LED, as the Standby mode means the LED is off. And sending 'off' then wakes it back up, so the LED starts again.
Found a dataset for the MT3339 Chipset (used by PA1010D), which has a much fuller definition for the commands. Hopefully will try to compile a better cmd file. Thought would note it here, that the current file seems incorrect.
Ok, found https://cdn.sparkfun.com/assets/parts/1/2/2/8/0/PMTK_Packet_User_Manual.pdf which mentions MT3339 chipset.
Packet Type: 285 PMTK_SET_PPS_CONFIG_CMD Packet Meaning: Configure PPS setting Data Field: PMTK285,PPSType,PPSPulseWidth PPSType: Availablity ‘0’ = Disable ‘1’ = After the first fix ‘2’ = 3D fix only ‘3’ = 2D/3D fix only ‘4’ = Always PPSPulseWidth: PPS pulse width (unit: ms) Example: $PMTK285,2,100*3E<CR><LF>
Which what I think pps.py was meant to be modifying, but was sending PMTK255, rather than PMTK285 - a typo? https://github.com/pimoroni/pa1010d-python/blob/master/examples/pps.py#L14
.. I can confirm that PMTK285 works (using cmd.py*) on the Pimoroni Breakout. At least being able to turn PPS on/off, and vary the pulsewidth, a short pulsewidth is nice to get a much less bright flash. Tried setting to mode 2, and and left it in a metal box, the PPS output stops.
- had to patch that, as don't get a PMTK385 reply it expecting. Just get a 
$PMTK001,285,3*3Freply. Might patch that too. 
Not made a pull request yet, might have further improvements, but a start.. https://github.com/pimoroni/pa1010d-python/compare/master...barryhunter:patch-1
A pull-request would be very welcome. Thank you.
I wonder if it's worth adding some of these more common commands into the API so we can just call gps.configure_pps() or similar.
ok, will do when get a chance. This is just a fun side project.
For reference, did find PMTK255 mentioned for setting on PPS on a different GPS Chipset (MT3337(e) rather than MT3333), so that's possible how the mistake got there. Nots sure if the breakout used to use a different chipset.
There is of course of bunch of other commands that can be setting, eg setting position interval, or setting the power management 'mode' all that could have dedicated wrapper commands.
Somewhere I have compiled a reference of all the available commands, needed to be compiled from various different datasheets.
Particularly interesting would to hook up the AlwaysLocate(TM) mode, with functions for extracting the recorded tracklog. (records tracks into internal Flash, without intervention from the MCU) ... but thats getting pretty advanced.