Adafruit Fona 3G GPS没有任何反应



我目前正在与我的一个涉及GPS跟踪的朋友一起从事一个项目。这是我们从Adafruit使用的FONA 3G GPS板。https://www.adafruit.com/product/3147

我们还使用推荐的活动GPS天线。由于我的声誉较低,我无法发布指向它的链接。

我们在MBED LPC1768微控制器上原型进行了原型。我们编写了自己的MBED代码,该代码通过MBED上的UART将命令发送到FONA,然后通过Putty在计算机上显示回复。我们已经尝试了几个Simple At Commands,例如制造商信息和SIM卡信息,并且这些命令效果很好。我们还尝试了要求电池级别等的命令中更复杂的,这些命令也有效。我们现在在获得GPS响应方面遇到困难。昨晚凌晨1点左右,我们能够通过AT CGPSINFO命令获得GPS响应,该命令向我们展示了延长,纬度,轴承等。但是,它的距离大约40英里。今天,当我们回去尝试解决此问题时,我们将无法从GPS那里收到任何回应。我们仍然可以从电池级别和其他命令中收到响应。只是GPS没有回应。我们已经在室内和室外尝试过,并在GPSTest模式下将模块运行一个多小时,但无济于事。

这是我们到目前为止拥有的代码。

#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("fnr-------------ESP8266 Hardware Reset-------------nr");
    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 ----------rn");
        strcpy(snd,"AT+CGPSFTM=1rn");
        sendFONA();
        timeout=10;
        getFONAreply();
        pc.printf(buf);
        wait(5);*/
        pc.printf("n---------- Get Battery Information ----------rn");
        strcpy(snd,"AT+CBCrn");
        sendFONA();
        timeout=5;
        getFONAreply();
        pc.printf(buf);
        wait(1);
        pc.printf("n---------- Get GPS Coordinates ----------rn");
        strcpy(snd,"AT+CGPSINFOrn");
        sendFONA();
        timeout=60;
        getFONAreply();
        pc.printf(buf);
        /*
        wait(2);
        pc.printf("n---------- Get Connected Devices ----------rn");
        strcpy(snd, "AT+CWLIFrn");
        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=115200rn");   // change the numeric value to the required baudrate
    SendCMD();
}
void FONAsetbaudrate()
{
    strcpy(snd, "AT+IPREX=115200rn");   // change the numeric value to the required baudrate
    SendCMD();
}
// FONA Config
void FONAconfig()
{
    pc.printf("---------- Starting FONA Config ----------rnn");
    strcpy(snd,"ATrn");
    sendFONA();
    timeout=1;
    getFONAreply();
    pc.printf(buf);
    wait(2);
    strcpy(snd,"ATIrn");
    sendFONA();
    timeout=1;
    getFONAreply();
    pc.printf(buf);
    wait(2);
    strcpy(snd,"AT+CGPSAUTO=1rn");
    sendFONA();
    timeout=1;
    getFONAreply();
    pc.printf(buf);
    // Test Mode (0=off / 1=on)
    strcpy(snd,"AT+CGPSFTM=0rn");
    sendFONA();
    timeout=1;
    getFONAreply();
    pc.printf(buf);
    /*
    wait(2);
    strcpy(snd,"AT+CGPS=0,1rn");
    sendFONA();
    timeout=1;
    getFONAreply();
    pc.printf(buf);
    wait(5);
    strcpy(snd,"AT+CGPSHOTrn");
    sendFONA();
    timeout=1;
    getFONAreply();
    pc.printf(buf);

    strcpy(snd,"AT+CGPS=1,1rn");
    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,"ATrn");
    SendCMD();
    wait(1);
    strcpy(snd,"ATrn");
    SendCMD();
    wait(1);
    strcpy(snd,"ATrn");
    SendCMD();
    timeout=1;
    getreply();
    wait(1);
    pc.printf("f---------- Starting ESP Config ----------rnn");
    pc.printf("---------- Reset & get Firmware ----------rn");
    strcpy(snd,"AT+RSTrn");
    SendCMD();
    timeout=5;
    getreply();
    pc.printf(buf);
    wait(2);
    pc.printf("n---------- Get Version ----------rn");
    strcpy(snd,"AT+GMRrn");
    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 ----------rn");
    strcpy(snd, "AT+CWMODE_CUR=3rn");
    SendCMD();
    timeout=4;
    getreply();
    pc.printf(buf);
    wait(2);
    pc.printf("n---------- SoftAP Configuration ----------rn");
    strcpy(snd, "AT+CWSAP_CUR="ESP8266","",11,0rn");
    SendCMD();
    timeout=10;
    getreply();
    pc.printf(buf);
    wait(2);
    // set CIPMUX to 0=Single,1=Multi
    pc.printf("n---------- Setting Connection Mode ----------rn");
    strcpy(snd, "AT+CIPMUX=1rn");
    SendCMD();
    timeout=4;
    getreply();
    pc.printf(buf);
    wait(2);
/*
    pc.printf("n---------- Listing Access Points 2 ----------rn");
    strcpy(snd, "AT+CWLAPrn");
    SendCMD();
    timeout=15;
    getreply();
    pc.printf(buf);*/
    wait(2);
    pc.printf("n---------- Connecting to AP ----------rn");
    pc.printf("ssid = %s   pwd = %srn",ssid,pwd);
    strcpy(snd, "AT+CWJAP="");
    strcat(snd, ssid);
    strcat(snd, "","");
    strcat(snd, pwd);
    strcat(snd, ""rn");
    SendCMD();
    timeout=10;
    getreply();
    pc.printf(buf);
    wait(5);
    pc.printf("n---------- Get IP's ----------rn");
    strcpy(snd, "AT+CIFSRrn");
    SendCMD();
    timeout=3;
    getreply();
    pc.printf(buf);
    wait(1);
    pc.printf("n---------- Get Connection Status ----------rn");
    strcpy(snd, "AT+CIPSTATUSrn");
    SendCMD();
    timeout=5;
    getreply();
    pc.printf(buf);
    pc.printf("n++++++++++ Pinging Site ++++++++++rn");
    strcpy(snd, "AT+PING="172.31.5.67"rn");  
    timeout=5;
    SendCMD();
    getreply();
    pc.printf(buf);
    strcpy(snd, "AT+PING="www.google.com"rn");  
    timeout=5;
    SendCMD();
    getreply();
    pc.printf(buf);
    pc.printf("n++++++++++ List of APs ++++++++++rn");
        strcpy(snd, "AT+CWLAPrn");  
        timeout=5;
        SendCMD();
        getreply();
        pc.printf(buf);
}
void SendCMD()
{
    esp.printf("%s", snd);
}
void sendFONA()
{
    fona.printf("%s", snd);
}
void getreply()
{
    memset(buf, '', 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, '', 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();
        }
    }
}

我们在此处使用的ESP模块也有代码,但是它已经评论了,我不认为这是问题。

这是我们运行此代码时得到的响应。Fona的输出

我们已经在室内和室外尝试了这些,并且在呼叫功能之间有不同程度的时间,而且似乎没有任何事情使它起作用。这尤其令人发指,因为这至少是昨晚给我们的坐标,即使这是错误的。现在,如您所见,它根本没有给我们坐标。

有人知道这里可能是什么问题?看来,由于该委员会相对较新且未经测试,因此对于这些问题没有一个很大的支持小组。谢谢您提供的任何帮助!

Sidenote:有人知道AMPI/AMPQ值的意思吗?我们认为这与信号强度有关,但似乎很随意。

这只是硬件故障。Adafruit向我们发送了一个新的FONA模块作为免费替换,替换模块工作正常。输出时间为程度分钟,需要将其转换为十进制分钟。

如果您使用的是活动天线,则需要焊接称为'偏见'的跳线。该跳线在GPS天线连接器旁边。

这立即解决了问题:)

相关内容

  • 没有找到相关文章

最新更新