get data from gps(FGPMMOPA6H) in codevision

Go To Last Post
19 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,
i have a FGPMMOPA6H gps Module and i need connect it to atmega16,
i connect them with usart but i just get x,xxx,?x,... in atmega16.
Should i use MAX232?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What have you tried to determine if the problem is with the gps module or the mega16?

If you give us more info, you might get a better answer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Google seems to suggest that this module uses Pa6H (well "V3" does):

https://learn.adafruit.com/adafruit-ultimate-gps/direct-computer-wiring

As you can see they make a direct connection to the Arduino Tx/Rx without the need for MAX232 so I guess it has TTL level serial output.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
What have you tried to determine if the problem is with the gps module or the mega16?

If you give us more info, you might get a better answer.


I don't Know what's my problem, atmega16 and gps module are connected with usart but I just get characters like x!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How is the AVR being clocked, at what speed and how are you setting the baud rate?

(99% of UART problems are clock speed!).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Baud Rate: 9600
clock 16mhz

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not the complete answer and I bet you meant Mhz not mhz!

So (a) have you verified the AVR really is running at 16MHz and (b) I ask again, how are you calculating/setting the baud rate.

For 9600 baud on 16MHz the UBRR should be 103 (I assume U2X is not used).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Basic steps to getting UART Communication working:

https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=116087...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i check that, change frequency and now i'm getting this:
P,K1D$P0G,40V,$P0G,50V,$P0G,.,P0G,.,$G$G1$G1G*$G1G*$G1G*$G1G

but this is not like:
$GPGGA,064951.000,2307.1256,N,12016.4438,E,1,8,0.95,39.9,M,17.8,M,,*65
or othr

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mohsen.j wrote:
now i'm getting this:
P,K1D$P0G,40V,$P0G,50V,$P0G,.,P0G,.,$G$G1$G1G*$G1G*$G1G*$G1G

How, exactly, do you determine that you are "getting" that?

What do you notice about the difference between what you're "getting", and what you expect?

How might you account for that difference?

You need to learn to think for yourself about the problems you're seeing, and what could be causing them.
This is an essential skill for any kind of development!

Here's some tips:

http://www.8052.com/faqs/120313

http://www.eetimes.com/discussio...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would say you are getting "some" of the data. Suggests your routine for reading the data is taking too long and missing some characters perhaps?

We can only guess because you haven't shown the code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm also using this GPS module with an ATmega32A4U and had no problems at all. The baud rate is 9600, format 8N1, and uses interrupts. The ISR only stores the complete sentence without interpreting it. After the terminal CR arrives it fires up an event, the handler checks the parity, and interprets the sentence at base level. It's important to make the interpretation fast, otherwise you'll get buffer overruns.
The code is part of a bigger program (about 30 modules), otherwise I'd send you a test program. it was developed with AS 6.2, not CodeVision
Jerry

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Good article on State Machines in general - and decoding NMEA sentences in particular:

http://www.visualgps.net/WhitePapers/NMEAParser/NMEAParser.html

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Good article on State Machines in general - and decoding NMEA sentences in particular:

http://www.visualgps.net/WhitePa...


The software isn't yet at the stage that one needs a state machine, except to wait for '$' to go by, then write the rest of the sentence to a buffer. - all he wants at the moment is an intact NMEA sentence to interpret
Jerry

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, I would agree that he hasn't yet completed the "get reliable UART comms working" stage.

Testing against a PC would probably be more appropriate at this stage - better controlled & easier to manage than the "live" GPS stuff...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:
Yes, I would agree that he hasn't yet completed the "get reliable UART comms working" stage.

Testing against a PC would probably be more appropriate at this stage - better controlled & easier to manage than the "live" GPS stuff...


The only problem with this approach is that you also need a level converter from RS232 (from 3 to 15V) to the TTL (about 2 to 5V). If you connect directly you'll most likely brick the MCU.
Even if the GPS receiver has no signal, it transmits correct sentences as soon as it is switched on, so you can still test the SW.
As previously noted, setting the right baud rate and protocol (9600, 8N1, no flow control are the MTK3339 defaults) fixes most problems.
Jerry

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you all. It's working
The baud rate register and clock frequency not match to each other.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

(99% of UART problems are clock speed!).

;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

jerryr wrote:
The only problem (sic?) with this approach is that you also need a level converter from RS232 (from 3 to 15V) to the TTL (about 2 to 5V)

Yes, that is is true - either that, or a USB-to-UART converter of the appropriate output level.

But I would regard these as absolutely basic "tools of the trade" - so not a "problem" as such.

And it seems I'm not alone: https://www.avrfreaks.net/index.p...

8)

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...