• Playing with @BillM 's code. Despite forcing AT6558(R?) into the SBAS mode by sending

    "PCAS15,4,FFFF"
    

    to the chip, the error is still over 7 meters.
    Is there a way to get the error below 2 meters as stated in most SBAS articles?

    UPD:
    After taking weighted by time between records average of recorded coordinates at a static point and comparing those average coordinates to the true coordinates, the error seems to be closer to 20 meters.

    UPD2:
    The command checksum is not included in the post. When the command is sent to the GPS chip the checksum is added.

  • I have tried to make the PCAS-commands a bit more usable in a library, but some seem to do nothing at all (e.g. setting Standby mode) while other work fine (update interval). Is there a way to dump the current config to check?

    Does your command miss the checksum or did you omit that on purpose?

    https://github.com/halemmerich/BangleApp­s/blob/pcas/modules/pcas.js

  • There is some helpful code at http://www.espruino.com/Bangle.js2+Techn­ical#gps that might help? It at least calculates the CRC

  • Thank for the reply. The post misses the checksum. The real code is:

    function checksum(str) {
    	var cs = 0;
      
    	for (const c of str) {
    		cs = cs ^ c.charCodeAt(0); //XOR
    	}
      
    	return cs.toString(16).toUpperCase().padStart(2­, '0');
    }
    
    function configureSBAS() {
       const thisTime = new Date(); 
       let timeString = thisTime.toISOString();
    	
      // SBAS satellite (SBAS satellite No. 1-19, corresponding to PRN 120-138
      var cmd = "PCAS15,4,FFFF"; //turn on satellites 1-16 of SBAS
      //var cmd = "PCAS15,4,7FFFF"; //turn on satellites 1-19 of SBAS
    
      cmd = "$" + cmd + "*" + checksum(cmd);
      Serial1.println(cmd);
      writeLogFile(timeString + ": " + cmd + "\n");
      
      SBASon = true;
    }
    
  • You are checksumming the command without the leading $, I think that needs to be included.

  • I thing line 19 of the presented code add the leading "$"

  • It does, but that happens after the checksum is calculated. The cmd going into checksum() does not yet contain it.

  • I'm not sure if "$" should be accounted in the checksum.
    As shown here, NMEA checksum calculation does not include "$" and "*"

    Lets assume the following NMEA sentence:

    $GPGLL,5300.97914,N,00259.98174,E,125926­,A*28
    

    In this sentence the checksum is the character representation of the
    hexadecimal value 28. The string that the checksum is calculated over
    is

    GPGLL,5300.97914,N,00259.98174,E,125926,­A
    

    To calculate the checksum you parse all characters between $ and *
    from the NMEA sentence into a new string.

  • I have tried it with PCAS02, the command to change the update rate and without the $ included in the checksum it changes nothing while including it works.

    print(require("pcas").checksum("$GPGLL,5­300.97914,N,00259.98174,E,125926,A")); creates a checksum of 28 which matches your example. Doing the same without $ calculates 6F as checksum.

    require("pcas").checksum is as follows:

    function checksum(cmd) {
      var cs = 0;
      for (var i = 1; i < cmd.length; i++)
        cs = cs ^ cmd.charCodeAt(i);
      return cmd + "*" + cs.toString(16).toUpperCase().padStart(2­, '0');
    }
    
  • Looks like @BillM implemented the checksum function another way. His version computes 28 without "$" sign. Attached screenshot


    1 Attachment

    • checksum.png
  • Oh wow, the confusion was on my end 😑.
    My function ignores the first character and so it needs the $ given to it to directly ignore it...

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Did anyone manage to get SBAS reliable working on B2?

Posted by Avatar for HopeToBeUseful1day @HopeToBeUseful1day

Actions