2016-06-22 30 views
0

Ich arbeite derzeit an einem Projekt mit einem Freund von mir, der GPS-Tracking beinhaltet. Dies ist die FONA 3G GPS-Karte, die wir von Adafruit verwenden. https://www.adafruit.com/product/3147Adafruit FONA 3G GPS zeigt keine Antwort

Wir verwenden auch die empfohlene aktive GPS-Antenne damit. Ich kann aufgrund meines schlechten Rufs keinen Link zu diesem Link veröffentlichen.

Wir entwickeln das System auf einem Mbed LPC1768 Mikrocontroller. Wir haben unseren eigenen mbed-Code geschrieben, der über den UART des mbed AT-Befehle an den FONA sendet und dann die Antwort auf dem Computer durch putty anzeigt. Wir haben mehrere AT-AT-Befehle ausprobiert, wie zum Beispiel Herstellerinformationen und SIM-Karten-Informationen, und diese haben gut funktioniert. Wir haben auch komplexere AT-Befehle ausprobiert, die den Batterieladestand und dergleichen anfordern, und diese funktionierten ebenfalls. Wir haben jetzt Probleme mit einer GPS-Antwort. Letzte Nacht gegen 1 Uhr morgens konnten wir eine GPS-Antwort mit dem Befehl AT + CGPSINFO bekommen, die uns Longitude, Latitude, Peilung und so weiter zeigt. Es war jedoch rund 40 Meilen entfernt. Heute, als wir zurück gingen, um zu versuchen, dies zu beheben, sind wir nicht in der Lage, irgendeine Antwort vom GPS zu erhalten. Wir können immer noch Antworten von der Batterieladung und anderen Befehlen erhalten. Es ist nur das GPS, das nicht reagiert. Wir haben dies drinnen und draußen probiert und das Modul im GPSTEST-Modus über eine Stunde lang laufen lassen, ohne Erfolg.

Dies ist der Code, den wir bisher haben.

#include "mbed.h" 

#define FONA_RST p12 
#define FONA_TX p13 
#define FONA_RX p14 
#define FONA_RI p11 
Serial fona(FONA_TX, FONA_RX); 

Serial pc(USBTX, USBRX); 
Serial esp(p28, p27); // tx, rx 
DigitalOut reset(p26); 
Timer t; 

int count,ended,timeout; 
char buf[4024]; 
char snd[255]; 

char ssid[32] = "ycp-web-wifi";  // enter WiFi router ssid inside the     quotes 
char pwd [32] = "YCPnet2005"; // enter WiFi router password inside the quotes 

void SendCMD(),getreply(),ESPconfig(),ESPsetbaudrate(),sendFONA(),getFONAreply(), FONAconfig(), FONAsetbaudrate(); 


int main() 
{ 
    reset=0; //hardware reset for 8266 
    pc.baud(9600); // set what you want here depending on your terminal program speed 
    pc.printf("\f\n\r-------------ESP8266 Hardware Reset-------------\n\r"); 
    wait(0.5); 
    reset=1; 
    timeout=2; 
    getreply(); 

    esp.baud(115200); // change this to the new ESP8266 baudrate if it is changed at any time. 
    fona.baud(115200); 
    //ESPsetbaudrate(); //****************** include this routine to set a different ESP8266 baudrate ****************** 

    //ESPconfig();  //****************** include Config to set the ESP8266 configuration *********************** 
    FONAconfig(); 

    while(1) { 
    /* 
     pc.printf("\n---------- GPS Test ----------\r\n"); 
     strcpy(snd,"AT+CGPSFTM=1\r\n"); 
     sendFONA(); 
     timeout=10; 
     getFONAreply(); 
     pc.printf(buf); 

     wait(5);*/ 

     pc.printf("\n---------- Get Battery Information ----------\r\n"); 
     strcpy(snd,"AT+CBC\r\n"); 
     sendFONA(); 
     timeout=5; 
     getFONAreply(); 
     pc.printf(buf); 

     wait(1); 

     pc.printf("\n---------- Get GPS Coordinates ----------\r\n"); 
     strcpy(snd,"AT+CGPSINFO\r\n"); 
     sendFONA(); 
     timeout=60; 
     getFONAreply(); 
     pc.printf(buf); 

     /* 
     wait(2); 
     pc.printf("\n---------- Get Connected Devices ----------\r\n"); 
     strcpy(snd, "AT+CWLIF\r\n"); 
     SendCMD(); 
     timeout=5; 
     getreply(); 
     pc.printf(buf); 
     wait(2);*/ 
    } 

} 

// Sets new ESP8266 baurate, change the esp.baud(xxxxx) to match your new setting once this has been executed 
void ESPsetbaudrate() 
{ 
    strcpy(snd, "AT+CIOBAUD=115200\r\n"); // change the numeric value to the required baudrate 
    SendCMD(); 
} 

void FONAsetbaudrate() 
{ 
    strcpy(snd, "AT+IPREX=115200\r\n"); // change the numeric value to the required baudrate 
    SendCMD(); 
} 

// FONA Config 
void FONAconfig() 
{ 
    pc.printf("---------- Starting FONA Config ----------\r\n\n"); 

    strcpy(snd,"AT\r\n"); 
    sendFONA(); 
    timeout=1; 
    getFONAreply(); 
    pc.printf(buf); 

    wait(2); 
    strcpy(snd,"ATI\r\n"); 
    sendFONA(); 
    timeout=1; 
    getFONAreply(); 
    pc.printf(buf); 

    wait(2); 
    strcpy(snd,"AT+CGPSAUTO=1\r\n"); 
    sendFONA(); 
    timeout=1; 
    getFONAreply(); 
    pc.printf(buf); 

    // Test Mode (0=off/1=on) 
    strcpy(snd,"AT+CGPSFTM=0\r\n"); 
    sendFONA(); 
    timeout=1; 
    getFONAreply(); 
    pc.printf(buf); 

    /* 
    wait(2); 
    strcpy(snd,"AT+CGPS=0,1\r\n"); 
    sendFONA(); 
    timeout=1; 
    getFONAreply(); 
    pc.printf(buf); 

    wait(5); 

    strcpy(snd,"AT+CGPSHOT\r\n"); 
    sendFONA(); 
    timeout=1; 
    getFONAreply(); 
    pc.printf(buf); 


    strcpy(snd,"AT+CGPS=1,1\r\n"); 
    sendFONA(); 
    timeout=1; 
    getFONAreply(); 
    pc.printf(buf);*/ 

} 

// +++++++++++++++++++++++++++++++++ This is for ESP8266 config only, run this once to set up the ESP8266 +++++++++++++++ 
void ESPconfig() 
{ 
    wait(5); 
    strcpy(snd,"AT\r\n"); 
    SendCMD(); 
    wait(1); 
    strcpy(snd,"AT\r\n"); 
    SendCMD(); 
    wait(1); 
    strcpy(snd,"AT\r\n"); 
    SendCMD(); 
    timeout=1; 
    getreply(); 
    wait(1); 
    pc.printf("\f---------- Starting ESP Config ----------\r\n\n"); 

    pc.printf("---------- Reset & get Firmware ----------\r\n"); 
    strcpy(snd,"AT+RST\r\n"); 
    SendCMD(); 
    timeout=5; 
    getreply(); 
    pc.printf(buf); 

    wait(2); 

    pc.printf("\n---------- Get Version ----------\r\n"); 
    strcpy(snd,"AT+GMR\r\n"); 
    SendCMD(); 
    timeout=4; 
    getreply(); 
    pc.printf(buf); 

    wait(3); 

    // set CWMODE to 1=Station,2=AP,3=BOTH, default mode 1 (Station)  
    pc.printf("\n---------- Setting Mode ----------\r\n"); 
    strcpy(snd, "AT+CWMODE_CUR=3\r\n"); 
    SendCMD(); 
    timeout=4; 
    getreply(); 
    pc.printf(buf); 

    wait(2); 

    pc.printf("\n---------- SoftAP Configuration ----------\r\n"); 
    strcpy(snd, "AT+CWSAP_CUR=\"ESP8266\",\"\",11,0\r\n"); 
    SendCMD(); 
    timeout=10; 
    getreply(); 
    pc.printf(buf); 

    wait(2); 

    // set CIPMUX to 0=Single,1=Multi 
    pc.printf("\n---------- Setting Connection Mode ----------\r\n"); 
    strcpy(snd, "AT+CIPMUX=1\r\n"); 
    SendCMD(); 
    timeout=4; 
    getreply(); 
    pc.printf(buf); 

    wait(2); 

/* 
    pc.printf("\n---------- Listing Access Points 2 ----------\r\n"); 
    strcpy(snd, "AT+CWLAP\r\n"); 
    SendCMD(); 
    timeout=15; 
    getreply(); 
    pc.printf(buf);*/ 

    wait(2); 

    pc.printf("\n---------- Connecting to AP ----------\r\n"); 
    pc.printf("ssid = %s pwd = %s\r\n",ssid,pwd); 
    strcpy(snd, "AT+CWJAP=\""); 
    strcat(snd, ssid); 
    strcat(snd, "\",\""); 
    strcat(snd, pwd); 
    strcat(snd, "\"\r\n"); 
    SendCMD(); 
    timeout=10; 
    getreply(); 
    pc.printf(buf); 

    wait(5); 

    pc.printf("\n---------- Get IP's ----------\r\n"); 
    strcpy(snd, "AT+CIFSR\r\n"); 
    SendCMD(); 
    timeout=3; 
    getreply(); 
    pc.printf(buf); 

    wait(1); 

    pc.printf("\n---------- Get Connection Status ----------\r\n"); 
    strcpy(snd, "AT+CIPSTATUS\r\n"); 
    SendCMD(); 
    timeout=5; 
    getreply(); 
    pc.printf(buf); 

    pc.printf("\n++++++++++ Pinging Site ++++++++++\r\n"); 
    strcpy(snd, "AT+PING=\"172.31.5.67\"\r\n"); 
    timeout=5; 
    SendCMD(); 
    getreply(); 
    pc.printf(buf); 

    strcpy(snd, "AT+PING=\"www.google.com\"\r\n"); 
    timeout=5; 
    SendCMD(); 
    getreply(); 
    pc.printf(buf); 

    pc.printf("\n++++++++++ List of APs ++++++++++\r\n"); 
     strcpy(snd, "AT+CWLAP\r\n"); 
     timeout=5; 
     SendCMD(); 
     getreply(); 
     pc.printf(buf); 
} 

void SendCMD() 
{ 
    esp.printf("%s", snd); 
} 

void sendFONA() 
{ 
    fona.printf("%s", snd); 
} 

void getreply() 
{ 
    memset(buf, '\0', sizeof(buf)); 
    t.start(); 
    ended=0; 
    count=0; 
    while(!ended) { 
     if(esp.readable()) { 
      buf[count] = esp.getc(); 
      count++; 
     } 
     if(t.read() > timeout) { 
      ended = 1; 
      t.stop(); 
      t.reset(); 
     } 
    } 
} 

void getFONAreply() 
{ 
    memset(buf, '\0', sizeof(buf)); 
    t.start(); 
    ended=0; 
    count=0; 
    while(!ended) { 
     if(fona.readable()) { 
      buf[count] = fona.getc(); 
      count++; 
     } 
     if(t.read() > timeout) { 
      ended = 1; 
      t.stop(); 
      t.reset(); 
     } 
    } 
} 

Es gibt auch Code für das ESP-Modul, das wir mit in hier arbeiten, aber es wird kommentiert, und ich glaube nicht, dass das Problem zu sein.

Hier ist die Antwort, die wir erhalten, wenn wir diesen Code ausführen. Output from the FONA

Wir haben dies drinnen und draußen versucht, und mit unterschiedlichem Zeitabstand zwischen den aufrufenden Funktionen, und nichts scheint zu funktionieren. Das ist besonders ärgerlich, weil es uns letzte Nacht wenigstens Koordinaten gegeben hat, obwohl es die falschen waren. Nun, wie Sie sehen, gibt es uns überhaupt keine Koordinaten.

Hat jemand eine Idee, was könnte das Problem hier sein? Da dieses Board relativ neu und ungetestet ist, scheint es keine sehr große Unterstützungsgruppe für diese Probleme zu geben. Danke für jede Hilfe, die Sie geben können!

Hinweis: Weiß jemand, was die AmpI/AmpQ-Werte bedeuten? Wir dachten, dass es etwas mit der Signalstärke zu tun hat, aber es scheint ziemlich willkürlich.

+0

Ich habe die gleichen Probleme wie auch ... – Kixoka

Antwort

0

Es war nur ein Hardwarefehler. Adafruit schickte uns ein neues FONA-Modul als kostenlosen Ersatz, und das Ersatzmodul funktionierte gut. Die Ausgabe war in Grad Minuten und muss in Dezimalminuten konvertiert werden.