problem with gps :( only 0.0000 instead of real data:(

Post here first, or if you can't find a relevant section!
therion
Posts: 13
Joined: Sun Jan 14, 2018 5:47 am

Re: problem with gps :( only 0.0000 instead of real data:(

Post by therion » Mon Jan 15, 2018 11:27 am

Gps diode is blinking so it recieve signal, but still on serial pot:
_____
TEST
0.000000
_____
TEST
0.000000

zmemw16
Posts: 1685
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: problem with gps :( only 0.0000 instead of real data:(

Post by zmemw16 » Mon Jan 15, 2018 11:34 am

ivstr led flashing means still trying to get signal lock, steady when it is locked.
usually when i took it outside and enough sky to see i think 3 sats at a minimum.

what i should do is ask what your actual hardware is ?
from ebay/aliexpress etc and can you post the link
or maybe you've built your own module ?
if you built your own, the 'gps' block has spi, uart & usb i/faces

time for long cable, equally long pole, zip ties and open the window :D
srp

therion
Posts: 13
Joined: Sun Jan 14, 2018 5:47 am

Re: problem with gps :( only 0.0000 instead of real data:(

Post by therion » Mon Jan 15, 2018 11:49 am

haha yeah winter -15C outside, and I standing and looking for blinking led:) Neighbours will have fun:)
Im sure that gps blinking led means "I have signal" i tried this with arduino and code from Stevestrong.

Aliexpress module, but before my experiments with stm32 i tried to use it with arduino and it works fine, in home and outside, led blinking had same effect.
Allways:
Led is blinking = data recieved
led off = no data, looking for satelites

User avatar
mrburnette
Posts: 2232
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: problem with gps :( only 0.0000 instead of real data:(

Post by mrburnette » Mon Jan 15, 2018 2:57 pm

from the PDF user manual: https://www.terraelectronica.ru/%2Fds%2 ... Manual.pdf
After waiting for a while, if the serial debugging assistant lists similar data in its
window as the figure shows below, it means GPS has performed positioning. And
you can see that the LED on the module, which remains on when GPS is unable
to perform the positioning, is flickering now.
When working with GPS (or any serial device) it is very helpful to have a USB-serial adapter or have some type of serial display device.

Other USB-serial:
https://www.adafruit.com/product/70
https://www.adafruit.com/product/3309

Ray

The following is PSoC 4200 C code for a state machine to decode GPS NMEA sentences.
Important stuff begins after the loop statement: for(;;)
The technique for parsing is the same utilized by Adafruit in their GPS library.

Code: Select all

	
/*
main.c
Project:    Nokia5110GLCD_PSoC4.cydwr (using bit-bang SPI)
Build date: 20140909 All code by Ray is public domain - OTHER? see Credits-Licenses.txt
UPDATED:    20140909 To include parsing of the month, day, and year
*/

#include <main.h>
#include <stdlib.h> // for function atoi()

#define NewLine() UART_UartPutChar(CR); UART_UartPutChar(LF);   // Used to insert a CR/LF
// Prototypes
void initSystem (void);

// Global variables
uint8_t len = GLCD_LCD_WIDTH / 6;       // 84 pixels / 6 == 14 ch/line
uint8_t hour, minute, seconds;          //, year, month, day;
uint8_t day, month, year;

char    buffer[GLCD_LCD_WIDTH / 6 + 1];
char    nmea[120];

// double  atof(const char *str);       // elimited Limor's float implementation

_Bool   DayLightSavings;                // Pin 3.4
uint8_t GMToffset = 4;
uint8_t Flag = 1;

int main()
{
    ForcedReset:;   // come here if onboard reset button pushed
    DayLightSavings = DSTime_Read();        // Normally true (HIGH)

    if(! DayLightSavings) GMToffset += 1;

    uint32  c = '\0';
    // int8_t  x   = 0 ;   // character position in line 0 ---> 13
    // int8_t  y  = 0 ;   // active line pointer        0 --->  5
    int8_t  k   = 0 ;
    initSystem();
    Flag = 1;          // firstTime since power-on or reset

    for(;;)
    {
        if (Flag == 1) {
            GLCD_WRITE("Waiting on GPS") ;
            // Flag = 0;
        }
        c = UART_UartGetChar();    // Get received character or null
        if (c)  
        {
            if(c == '$') {          // $ start of NMEA sentences
                for(k=0; k<5; k++)  // need 5 characters for sentence type
                {
                    LED_Write( ~LED_Read() );   // flicker LED for activity
                    do {
                        c = UART_UartGetChar();
                    }
                    while (! (c));
                    nmea[k] = c;    // G + P + R + M + C
                    // sprintf(buffer + k, "%c", c) ;  // only for debug
                }
                // DEBUGGING to GLCD
                // glcd_tiny_draw_string(0, 3, buffer);
                // glcd_write() ;                   // display
                LED_Write( LOW );                   // LED off
                if (strstr(nmea, "GPRMC"))
                {
                    do {
                        do {
                            c = UART_UartGetChar();
                            LED_Write( ~LED_Read() ); // flicker LED
                        } while (!(c));
                        nmea[k] = c;
                        ++k;
                    } while ( !( c == '*' ) && k < 120) ;   // marker
                    LED_Write( LOW );                       // LED off
                    // Inspiration: Limor Fried's Arduino GPS lib
                    char *p = nmea;
                    p = strchr(p, ',') + 1;   // position after 1st comma
                    // float    timef  = atof(p);
                    // uint32_t  time  = timef;
                    uint32_t time = atoi(p);
                              hour  = time / 10000;
                            minute  = (time % 10000) / 100;
                           seconds  = (time % 100);
                    // output to GLCD
                    sprintf(buffer, "              %s","");  // clearbuffer
                    
                    // this corrects time to the West but not the date!!!
                    if( hour > GMToffset) {
                        hour = hour - GMToffset;
                    } else {
                        hour = (hour + 24) - GMToffset; }

                    // correct midnight to follow standard format
                    if (hour == 24) hour = 0;

                    if (hour < 10) {
                        if (DayLightSavings) {
                            sprintf(buffer, "EDT:  %d", hour);
                        } else {
                            sprintf(buffer, "EST:  %d", hour);
                        }
                    } else {
                        if (DayLightSavings) {
                            sprintf(buffer, "EDT: %d%d", hour);
                        } else {                       
                        sprintf(buffer, "EST: %d%d", hour); }
                    }
                    if (minute < 10) {
                        sprintf(buffer + 7, ":0%d", minute);
                    } else {
                        sprintf(buffer + 7, ":%d%d", minute); }
                    if (seconds < 10) {
                        sprintf(buffer + 10,":0%d%s", seconds);
                    } else {
                        sprintf(buffer + 10, ":%d%d%s", seconds); }
                    sprintf(buffer + 13, "%s", "\0");
                    if(Flag == 1)
                    {
                        Flag = 0;
                        glcd_clear() ;
                        CyDelay(250) ;
                    }
                    // OUTPUT the TIME on GLCD
                    glcd_tiny_draw_string(0, 4, buffer);
                    glcd_write() ;
                    // Parse to integer date field
                    p = strchr(p, ',') +1;  // A/V?
                    p = strchr(p, ',') +1;  // lat
                    p = strchr(p, ',') +1;  // N/S?
                    p = strchr(p, ',') +1;  // lon
                    p = strchr(p, ',') +1;  // E/W?
                    p = strchr(p, ',') +1;  // speed
                    p = strchr(p, ',') +1;  // angle
                    p = strchr(p, ',') +1;  // move pass for date DDMMYY
                    // nmea date field looks like: 090914 (European)
                    uint32_t fulldate = atoi(p);
                    day     = (fulldate / 10000);
                    month   = (fulldate % 10000) / 100;
                    year    = (fulldate % 100);
                    sprintf(buffer, "              %s","");  // clearbuffer
                    if (day < 10) {
                        sprintf(buffer, "0%d", day);
                    } else {
                        sprintf(buffer, "%d%d", day); }
                    if (month < 10) {
                        sprintf(buffer + 2,"-0%d", month);
                    } else {
                        sprintf(buffer + 2,"-%d%d", month); }
                    sprintf(buffer + 5, "-20%d%d%s", year);
                    sprintf(buffer + 10,"%s",'\0');
                    // OUTPUT the DATE on GLCD
                    glcd_tiny_draw_string(0, 2, buffer);
                    glcd_write() ;
                }   // if (strstr(nmea, "GPRMC"))
            }       // if(c == '$')
        }           // if(c)
        if( ResetSW_Read() == LOW ) // Forced program restart
        {
            goto ForcedReset;
        }
    }               // for(,,)
}                   // main()

void initSystem() 
{
    CyGlobalIntEnable;
    LED_Write( HIGH );
    UART_Start();
    glcd_init();
    glcd_set_contrast(75);      //0== light 100==full black
    GLCD_TEXT_INIT();
    init_printf(NULL, putdata); // see main.h
    // Announce activity to over serial console in case listening
    UART_UartPutString("Hardware Configured\n"); NewLine(); NewLine();
    GLCD_WRITE("Terminal V1.00");
    GLCD_WRITE("Ray Burnette");
    CyDelay(2000);
    glcd_clear();
}

/* [] END OF FILE */
Nokia5110GPS_PSoC4.cyprj.Archive03.zip


CODE
file_3727.txtC/C++
main.c
/*

Project:    Nokia5110GLCD_PSoC4.cydwr (using bit-bang SPI)
Build date: 20140909 All code by Ray is public domain - OTHER? see Credits-Licenses.txt
UPDATED:    20140909 To include parsing of the month, day, and year
*/

#include <main.h>
#include <stdlib.h> // for function atoi()

#define NewLine() UART_UartPutChar(CR); UART_UartPutChar(LF);   // Used to insert a CR/LF
// Prototypes
void initSystem (void);

// Global variables
uint8_t len = GLCD_LCD_WIDTH / 6;       // 84 pixels / 6 == 14 ch/line
uint8_t hour, minute, seconds;          //, year, month, day;
uint8_t day, month, year;

char    buffer[GLCD_LCD_WIDTH / 6 + 1];
char    nmea[120];

// double  atof(const char *str);       // elimited Limor's float implementation

_Bool   DayLightSavings;                // Pin 3.4
uint8_t GMToffset = 4;
uint8_t Flag = 1;

int main()
{
    ForcedReset:;   // come here if onboard reset button pushed
    DayLightSavings = DSTime_Read();        // Normally true (HIGH)

    if(! DayLightSavings) GMToffset += 1;

    uint32  c = '\0';
    // int8_t  x   = 0 ;   // character position in line 0 ---> 13
    // int8_t  y  = 0 ;   // active line pointer        0 --->  5
    int8_t  k   = 0 ;
    initSystem();
    Flag = 1;          // firstTime since power-on or reset

    for(;;)
    {
        if (Flag == 1) {
            GLCD_WRITE("Waiting on GPS") ;
            // Flag = 0;
        }
        c = UART_UartGetChar();    // Get received character or null
        if (c)  
        {
            if(c == '$') {          // $ start of NMEA sentences
                for(k=0; k<5; k++)  // need 5 characters for sentence type
                {
                    LED_Write( ~LED_Read() );   // flicker LED for activity
                    do {
                        c = UART_UartGetChar();
                    }
                    while (! (c));
                    nmea[k] = c;    // G + P + R + M + C
                    // sprintf(buffer + k, "%c", c) ;  // only for debug
                }
                // DEBUGGING to GLCD
                // glcd_tiny_draw_string(0, 3, buffer);
                // glcd_write() ;                   // display
                LED_Write( LOW );                   // LED off
                if (strstr(nmea, "GPRMC"))
                {
                    do {
                        do {
                            c = UART_UartGetChar();
                            LED_Write( ~LED_Read() ); // flicker LED
                        } while (!(c));
                        nmea[k] = c;
                        ++k;
                    } while ( !( c == '*' ) && k < 120) ;   // marker
                    LED_Write( LOW );                       // LED off
                    // Inspiration: Limor Fried's Arduino GPS lib
                    char *p = nmea;
                    p = strchr(p, ',') + 1;   // position after 1st comma
                    // float    timef  = atof(p);
                    // uint32_t  time  = timef;
                    uint32_t time = atoi(p);
                              hour  = time / 10000;
                            minute  = (time % 10000) / 100;
                           seconds  = (time % 100);
                    // output to GLCD
                    sprintf(buffer, "              %s","");  // clearbuffer
                    
                    // this corrects time to the West but not the date!!!
                    if( hour > GMToffset) {
                        hour = hour - GMToffset;
                    } else {
                        hour = (hour + 24) - GMToffset; }

                    // correct midnight to follow standard format
                    if (hour == 24) hour = 0;

                    if (hour < 10) {
                        if (DayLightSavings) {
                            sprintf(buffer, "EDT:  %d", hour);
                        } else {
                            sprintf(buffer, "EST:  %d", hour);
                        }
                    } else {
                        if (DayLightSavings) {
                            sprintf(buffer, "EDT: %d%d", hour);
                        } else {                       
                        sprintf(buffer, "EST: %d%d", hour); }
                    }
                    if (minute < 10) {
                        sprintf(buffer + 7, ":0%d", minute);
                    } else {
                        sprintf(buffer + 7, ":%d%d", minute); }
                    if (seconds < 10) {
                        sprintf(buffer + 10,":0%d%s", seconds);
                    } else {
                        sprintf(buffer + 10, ":%d%d%s", seconds); }
                    sprintf(buffer + 13, "%s", "\0");
                    if(Flag == 1)
                    {
                        Flag = 0;
                        glcd_clear() ;
                        CyDelay(250) ;
                    }
                    // OUTPUT the TIME on GLCD
                    glcd_tiny_draw_string(0, 4, buffer);
                    glcd_write() ;
                    // Parse to integer date field
                    p = strchr(p, ',') +1;  // A/V?
                    p = strchr(p, ',') +1;  // lat
                    p = strchr(p, ',') +1;  // N/S?
                    p = strchr(p, ',') +1;  // lon
                    p = strchr(p, ',') +1;  // E/W?
                    p = strchr(p, ',') +1;  // speed
                    p = strchr(p, ',') +1;  // angle
                    p = strchr(p, ',') +1;  // move pass for date DDMMYY
                    // nmea date field looks like: 090914 (European)
                    uint32_t fulldate = atoi(p);
                    day     = (fulldate / 10000);
                    month   = (fulldate % 10000) / 100;
                    year    = (fulldate % 100);
                    sprintf(buffer, "              %s","");  // clearbuffer
                    if (day < 10) {
                        sprintf(buffer, "0%d", day);
                    } else {
                        sprintf(buffer, "%d%d", day); }
                    if (month < 10) {
                        sprintf(buffer + 2,"-0%d", month);
                    } else {
                        sprintf(buffer + 2,"-%d%d", month); }
                    sprintf(buffer + 5, "-20%d%d%s", year);
                    sprintf(buffer + 10,"%s",'\0');
                    // OUTPUT the DATE on GLCD
                    glcd_tiny_draw_string(0, 2, buffer);
                    glcd_write() ;
                }   // if (strstr(nmea, "GPRMC"))
            }       // if(c == '$')
        }           // if(c)
        if( ResetSW_Read() == LOW ) // Forced program restart
        {
            goto ForcedReset;
        }
    }               // for(,,)
}                   // main()

void initSystem() 
{
    CyGlobalIntEnable;
    LED_Write( HIGH );
    UART_Start();
    glcd_init();
    glcd_set_contrast(75);      //0== light 100==full black
    GLCD_TEXT_INIT();
    init_printf(NULL, putdata); // see main.h
    // Announce activity to over serial console in case listening
    UART_UartPutString("Hardware Configured\n"); NewLine(); NewLine();
    GLCD_WRITE("Terminal V1.00");
    GLCD_WRITE("Ray Burnette");
    CyDelay(2000);
    glcd_clear();
}

/* [] END OF FILE */


therion
Posts: 13
Joined: Sun Jan 14, 2018 5:47 am

Re: problem with gps :( only 0.0000 instead of real data:(

Post by therion » Tue Jan 16, 2018 11:02 am

Mrburnette maybe You are right, i don't like to read manuals like that, because they are in english and usually in technician language.
As You can see my english is wery bad, and it is problem for me. I'm using it when i must. I must use google translator to read/write posts here.

I write about blinking led because of my expeiments and experiencees with aduino.
When led was off there was nothing on screen, when blinking i had correct coordinates, led never be stabile on. Only off or blink status never on even after half hour outside. So in my opinion situation was simple, when LED off - bad, blinking - good:)

I dont have adapter, i am waiting for shipment from china, but it will be in next month.
Unfortunetly Youre code is too dificult for me, i am really begginer. I have made only few simple pojects based on examples:(

stevestrong
Posts: 2070
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: problem with gps :( only 0.0000 instead of real data:(

Post by stevestrong » Tue Jan 16, 2018 12:24 pm

@therion, your results are somehow not coherent.
If you previously had some characters received from the GPS module, you should get some characters by the last example, too.
You should always test under the same conditions.
So go back and test all previous examples again.

Post Reply