GPS Project: PIC18F26K22 or PIC18F46K22


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    Try changing this:
    Code:
                DEFINE HSER_CLROERR2 1 ' Clear overflow automatically
    to this:
    Code:
                DEFINE HSER2_CLROERR 1 ' Clear overflow automatically
    You'll definitely be getting overrun errors, so if they're not cleared properly it'll stop receiving.

    I'd also try some a LOT simpler to start with. I'd be amazed if those HSERIN2 commands in your main loop work reliably... one thing out of place and it'll likely take a long time to sync up again (if ever).

  2. #2
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    Hi tumbleweed,

    that was the typo mistake really. Now it works. thanks a lot.

    I was stuck for a day! Now i can move forward to the next target.

    Really appreciate your help.

  3. #3
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    Dear all,

    as for the last step, changing the baudrate of the GPS on the fly, the same time as the PIC chip it self on PORT EUART 2, i've notice that not all the time the configuration work.

    Sometimes the GPS doesn't get the command. I tried to see if i could get an ACK but couldn't see anything coming on RX.

    Base on the manufacturer datasheet there should be a reply message for every command we send. But really didn't see any reply.

    Is there anything i could do, to help the GPS to receive always the command and not "reject" it? Should i give more time at start up?

    I have already place the following commands on the code in order to check if the GPS has successfully powered up.

    Code:
    ' -----------------------------------------------------------------------------|  
    '                          [ GPS Initialization ]                              |
    '------------------------------------------------------------------------------| 
    ' When the GPS Module is POWERED ON, then the following sentenses are received.       
    HSERIN2 [wait("PMTK011,MTKGPS*08")]
    HSERIN2 [wait("PMTK010,001*2E")] 
    HSERIN2 [wait("PMTK010,002*2D")]
    Last edited by astanapane; - 14th July 2018 at 23:00.

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    I'd be amazed if those HSERIN2 commands in your main loop work reliably
    I agree with tumbleweeds thought, increasing baud rate to 38k cuts the time available to process that streamed data to one quarter of what was available at 9600 baud . its asking for trouble .
    what possible advantage are you seeking with the higher baud rate ?
    there is great merit in sending data to the serial display as fast as possible but I have difficulty seeing any benefit in getting nmea data at higher speeds.

    now that you have a chip with adequate memory and horsepower why not use a buffer to store and process the sentences?
    Warning I'm not a teacher

  5. #5
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    Quote Originally Posted by richard View Post
    I agree with tumbleweeds thought, increasing baud rate to 38k cuts the time available to process that streamed data to one quarter of what was available at 9600 baud . its asking for trouble .
    what possible advantage are you seeking with the higher baud rate ?
    there is great merit in sending data to the serial display as fast as possible but I have difficulty seeing any benefit in getting nmea data at higher speeds.

    now that you have a chip with adequate memory and horsepower why not use a buffer to store and process the sentences?
    Hi Richard, to be honest i dont know the way to store and process the sentences , but i will search for it and come back with some question. First i will try to understand the concept.

    Now at the moment i need to speed up the serial communication because i need to use to fastest refresh rate of NMEA data from GPS at 10Hz.

    As from the manufacturer and datasheet of the GPS, if you need to go at 5Hz or 10Hz then you need at least to speed up the GPS communication rate at 38400.

    The SERIN command inside the main look, do not have any issue. Only at the beginning of the initialization and changing the baudrate and refresh rate.

    Apart from that everything else works fine at that rate. At the end of the project which may not be able to complete, i will not use the GPS at 10Hz.

    Now i do some fancy test to see how fast the Speed on the Display can be refreshed. As you better understand than me, in order to achieve that, the GPS data must be at a very high rate and the serial communication as well. Actually is a simple speedometer.

    Thanks once again all of you for your time and effort to help me.

  6. #6
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    Do you control power to the GPS?

    The sequence of what to do depends on who powers up first. You probably shouldn't assume that the mcu is powered up and initialized before the GPS. It would be good to know how long the GPS takes to powerup and start sending those initial strings.

    The sequence might look something like:

    - wait several seconds at powerup for the GPS to initialize
    leave the uart set for 9600 baud
    You'll likely miss any initial serial transmissions that the GPS sends you, but that's ok.

    - send a string to the GPS that you know the response for, and wait for that response with a timeout.
    The simpler the better... a single response that's easy to parse would work a lot better than a sequence of responses.
    loop doing this until you have sync with the GPS.

    - now you can switch to 38400

  7. #7
    Join Date
    Oct 2010
    Posts
    413


    Did you find this post helpful? Yes | No

    Default Re: GPS Project: PIC18F26K22 or PIC18F46K22

    Quote Originally Posted by tumbleweed View Post
    Do you control power to the GPS?

    The sequence of what to do depends on who powers up first. You probably shouldn't assume that the mcu is powered up and initialized before the GPS. It would be good to know how long the GPS takes to powerup and start sending those initial strings.

    The sequence might look something like:

    - wait several seconds at powerup for the GPS to initialize
    leave the uart set for 9600 baud
    You'll likely miss any initial serial transmissions that the GPS sends you, but that's ok.

    - send a string to the GPS that you know the response for, and wait for that response with a timeout.
    The simpler the better... a single response that's easy to parse would work a lot better than a sequence of responses.
    loop doing this until you have sync with the GPS.

    - now you can switch to 38400
    Hi tumbleweed,

    i think i could control the GPS module via Enable pin.

    The GPS based on the datasheet, powerup and start sending commands after the following PMTKs.

    Code:
    ' -----------------------------------------------------------------------------|  
    '                          [ GPS Initialization ]                              |
    '------------------------------------------------------------------------------| 
    ' When the GPS Module is POWERED ON, then the following sentenses are received.       
    HSERIN2 [wait("PMTK011,MTKGPS*08")]
    HSERIN2 [wait("PMTK010,001*2E")] 
    HSERIN2 [wait("PMTK010,002*2D")]
    I guess that by using the above code, i wait for each of this commands, and the program only continues if those PMKT sentences from GPS has been received and read. Is that right?

    May i use a timeout in there?

Similar Threads

  1. PIC18F46K22 config issue
    By LGabrielson in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 29th September 2012, 03:20
  2. Replies: 1
    Last Post: - 27th July 2008, 06:14
  3. Pic GPS project Demo
    By Art in forum GPS
    Replies: 0
    Last Post: - 28th October 2007, 03:05
  4. GPS project question
    By mjp130 in forum GPS
    Replies: 6
    Last Post: - 4th July 2007, 20:09
  5. gps project
    By chuckad in forum GPS
    Replies: 2
    Last Post: - 9th February 2007, 02:52

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts