Troubleshooting BLE GPS Issues

hi all

i am trying to get ble gps working on a esp32 with a clone m10 gps chip
i loosely ported over the code from aollin/racechrono-ble-diy-device to use nimble-arduino and adafruit_gps library
canbus works fine

i just cant get ble gps to work, it keeps saying no fix to satellite even when gps->fixquality = 1 and gps->satellites = 10
can someone advise ways on further troubleshooting this? would love to get GPS at 10/18Hz working before my next track session

thanks

Comments

  • code, pretty much the same from aollin's example

    if (gps->parse(gps->lastNMEA())) {
    // NMEA message parsed successfully
    //debugln("gps->newNMEAreceived() && gps->parse(gps->lastNMEA())");

    // Calculate date field
    int dateAndHour = (gps->year * 8928) + ((gps->month-1) * 744) + ((gps->day-1) * 24) + gps->hour;
    if (gpsPreviousDateAndHour != dateAndHour) {
    gpsPreviousDateAndHour = dateAndHour;
    gpsSyncBits++;
    }

    // Calculate time field
    int timeSinceHourStart = (gps->minute * 30000) + (gps->seconds * 500) + (gps->milliseconds / 2);

    // Calculate latitude and longitude
    int latitude = gps->latitude_fixed; // / 10000000) * 6000000 + (gps->latitude_fixed % 10000000);
    int longitude = gps->longitude_fixed; // / 10000000) * 6000000 + (gps->longitude_fixed % 10000000);

    // Calculate altitude, speed and bearing
    int altitude = gps->altitude > 6000.f ? (max(0, (int)(round(gps->altitude + 500.f))) & 0x7FFF) | 0x8000 : max(0, (int)(round((gps->altitude + 500.f) * 10.f))) & 0x7FFF;
    int speed = gps->speed > 600.f ? ((max(0, (int)(round(gps->speed * 10.f)))) & 0x7FFF) | 0x8000 : (max(0, (int)(round(gps->speed * 100.f)))) & 0x7FFF;
    int bearing = max(0, (int)(round(gps->angle * 100.f)));

    // Create main data
    tempGPSMainData[0] = ((gpsSyncBits & 0x7) << 5) | ((timeSinceHourStart >> 16) & 0x1F);
    tempGPSMainData[1] = timeSinceHourStart >> 8;
    tempGPSMainData[2] = timeSinceHourStart;
    tempGPSMainData[3] = ((min(0x03, (int)gps->fixquality) & 0x3) << 6) | (min(0x3F, (int)gps->satellites) & 0x3F);
    tempGPSMainData[4] = latitude >> 24;
    tempGPSMainData[5] = latitude >> 16;
    tempGPSMainData[6] = latitude >> 8;
    tempGPSMainData[7] = latitude >> 0;
    tempGPSMainData[8] = longitude >> 24;
    tempGPSMainData[9] = longitude >> 16;
    tempGPSMainData[10] = longitude >> 8;
    tempGPSMainData[11] = longitude >> 0;
    tempGPSMainData[12] = altitude >> 8;
    tempGPSMainData[13] = altitude;
    tempGPSMainData[14] = speed >> 8;
    tempGPSMainData[15] = speed;
    tempGPSMainData[16] = bearing >> 8;
    tempGPSMainData[17] = bearing;
    tempGPSMainData[18] = round(gps->HDOP * 10.f);
    tempGPSMainData[19] = 0xFF; // Unimplemented

    if (gpsSubValue > 0) {
    // Notify main characteristics
    gpsMainCharacteristic->notify(tempGPSMainData, 20, BLE_HS_CONN_HANDLE_NONE);
    //debugln("gpsMain notify");
    debug("M");
    }

    // Create time data
    tempGPSTimeData[0] = ((gpsSyncBits & 0x7) << 5) | ((dateAndHour >> 16) & 0x1F);
    tempGPSTimeData[1] = dateAndHour >> 8;
    tempGPSTimeData[2] = dateAndHour;

    if (gpsSubValue > 0) {
    // Notify time characteristics
    gpsTimeCharacteristic->notify(tempGPSTimeData, 3, BLE_HS_CONN_HANDLE_NONE);
    //debugln("gpsTime notify");
    debug("T");
    }

    } else {
    // didnt parse correctly ends up here, big flood of messages if enabled
    }
    }

    sample output
    tempGPSMainData[0]: 35
    tempGPSMainData[1]: 80
    tempGPSMainData[2]: 12
    tempGPSMainData[3]: 76
    tempGPSMainData[4]: 13
    tempGPSMainData[5]: 93
    tempGPSMainData[6]: 216
    tempGPSMainData[7]: 48
    tempGPSMainData[8]: 68
    tempGPSMainData[9]: 23
    tempGPSMainData[10]: 83
    tempGPSMainData[11]: 0
    tempGPSMainData[12]: 24
    tempGPSMainData[13]: 89
    tempGPSMainData[14]: 0
    tempGPSMainData[15]: 3
    tempGPSMainData[16]: 0
    tempGPSMainData[17]: 0
    tempGPSMainData[18]: 27
    tempGPSMainData[19]: 0
    tempGPSTimeData[0]: 35
    tempGPSTimeData[1]: 109
    tempGPSTimeData[2]: 180
  • nvm, its a bluetooth stack issue. switched over to use the esp32 ble stack and its all good
Sign In or Register to comment.