Jump to content
Sign in to follow this  
DArkwIng

EM-406A

Recommended Posts

Trying to get NMEA from this su...r an only getting jibbrich.. using a opto coupler to RS-232 direclty to pin 4 and 5 and power of course.

doing it wrong? :P do i need to send some sort of command to it... and if, how?

i'm a total noob on this but shouldn't it just send me NMEA stings that I should be able to see in Hyperterminal or putty?

Edited by DArkwIng

Share this post


Link to post
Share on other sites

Yes, it should give NMEA, unless it's set to talk in SiRF protocol. Is the baudrate correct?

What exactly did you make as an interface? the 0-5V levels need to be converted to +/-12V and inverted to be compliant with a PC's RS232 port.

Share this post


Link to post
Share on other sites
Yes, it should give NMEA, unless it's set to talk in SiRF protocol. Is the baudrate correct?

What exactly did you make as an interface? the 0-5V levels need to be converted to +/-12V and inverted to be compliant with a PC's RS232 port.

As the documentation says (@ http://www.usglobalsat.com/download/46/em406a_ug.pdf), we are using

4800 baud

stopbit 1

databit 8

paritet none

flowcontrol none.

As an interface cable between the PC and the GPS, we used an optical interface cable, witch works like an MAX3232 chip. Converts RS232 signal between 12V and 3V both ways. In other word, an opto coupler for RS232. As a power supply, we used the muvium controller for stable 5V DC.

But we are attempt to use an Muvium controller ( uVMDEM-SBC65EC) to pick up the signals. And 5V signal should work fine. But then we still got some useless data from the GPS. Dec. goes from -127 to +127 while reading the input. And theese values does not make sense even when we tries to convert them to Characters.

So what we need, is an instruction how to read data from the GPS and display them as a NMEA-string. We have tried to put the RX-pin at the GPS to high-level with a resistor to 5V.

Share this post


Link to post
Share on other sites

The data coming out of the EM-406 is ASCII text at 4800 baud. It takes extraordinary measures to make it output in the other {binary} format. So, if you don't see intelligent NMEA strings then the problem is in your serial interface or communication protocol.

I suspect that your PC does not like the optical interface circuit since it probably does not fully adhere to the RS232 standards. Wire up a MAX232 instead and try it.

Share this post


Link to post
Share on other sites
The data coming out of the EM-406 is ASCII text at 4800 baud. It takes extraordinary measures to make it output in the other {binary} format. So, if you don't see intelligent NMEA strings then the problem is in your serial interface or communication protocol.

I suspect that your PC does not like the optical interface circuit since it probably does not fully adhere to the RS232 standards. Wire up a MAX232 instead and try it.

The cable is an RS 232 standard barrier, It works on other GPS-systems like Offshore supply ships, but allows voltages from 0->50V signals.

How ever, I figured out the problem. Only that there are some buggy data coming in to my micro controller. I was hopin that the input was more stable.

I used this code on my micro controller:

import com.muvium.UVMRunnable;

import com.muvium.apt.*;

import java.io.*;


public class Flowreader extends UVMRunnable implements SerialPortListener {


	SerialPort vcom0;

	InputStream inn1;

	public void serialEvent(SerialPortEvent event) {

						int data = 0;

			try {

				data = inn1.read();

			  //  if((byte)data=="$".getBytes()[0]){System.out.println("\r\n");}

				System.out.print((char)data);

			} catch (IOException ex) {

				System.out.println(ex);

			}

	}

	public void run() {

		System.out.println("Init");

			System.out.println("Starting");

			try {

				vcom0 = getPeripheralFactory().createSerialPort(this,

						PeripheralFactory.EVENT_PRIORITY_1,

						SerialPort.COM0 |

						SerialPort.IMPLEMENTATION_VIRTUAL |

						SerialPort.BAUD_4800);//2400			   

				vcom0.setInputBufferSize(50);

				vcom0.start();

				inn1 = vcom0.getInputStream();

			} catch (Exception e) {

				System.out.println(e);

				System.out.println("Error Com creation");

			}


			while(true){doEvents();}	  

	}

  }

}
Some of the Console-log:
$GPGSV12,07,20,290,,25,12,273,,21,36,076,,15,18,040,*78



$GPRMC,172517.499,A,6228,00614.0204,E,0.00,,071008,,*1B



$GPGGA,172518.499,6228.3216,N,00614.0088,E,0,04,,9.8,M3.3,M,,0000*75



$GPGSA,A,1,03,06,18,19,,,,,,,,,,,*1A



$GPRMC,17259,A,6228.3216,N,00614.0088,E,,,071008,,*0A



$GPGGA,172519.499,6228.3284,N,00614.0205,E,1,05,2.0,12.2,M,3,M,,0000*64



$GPGSA,A,3,03,06,18,19,16,,,,,,,,3.6,2.9*3D



$GPRMC,172519.499,A,6228.3284,N,00614.0205,E,0.17,0,071008,,*07



$GPGGA,172520.000,6228.3244,N,00614.0201,E,1,08,1.2,19.8,M,43.3,M,,0000


$GPGSA,A,3,03,06,18,19,16,22,27,08,,,,,2.0,1.2,1.6*


$GPRMC,172520.000,A,6228.3244,N,00614.0201,E,0.40,37,071008,,*02

As you can see, there are some bytes missing some places, like N/S notation in one of the GPRMC-lines, and entire data values in other lines like Course ower ground.

Share this post


Link to post
Share on other sites

I'm not familiar with the functions you are using, but your InputBufferSize (50) seems too small if it is expected to hold the largest NMEA string. Other than that, just keep hammering away at the code. The GPS will happily send the NMEA data, even without a satellite fix, so the rest is up to you and your host.

Share this post


Link to post
Share on other sites

Thank you for your tip to changed the buffer from 50 to 100. That helped alot on the errors in the stream. But ther are still some errors in the stream.

How many errors do I have to accept to recive per 100 lines? Should the GPS send 100% coorect all the time, or does it have some bugs?

Having less than 5cm (2inches) of wire between the GPS and controller.

Edited by ThaEagle

Share this post


Link to post
Share on other sites

The GPS does not send NMEA strings that have errors. If there are data corruptions, it would be due to issues external to the GPS module. So, you should continue to debug the host's hardware and software to determine why you are getting errors.

For example, the debug printing might be one source of problems. What is the function System.out.print((char)data) using to display the results? Is this a com port? If it is, then maybe it is taking too much time to send the captured strings and your small 100 byte NMEA input buffer is occasionally overflowing. That's just one of many things you should investigate.

Share this post


Link to post
Share on other sites

Again, thank you for your help.

On my controller, there is one hardware standard RS232 COM-port so you can upload software to the controller and read messages from the controller by using System.out.println(Message); You will now be able to read the message in Hyper Terminal or Putty. The baudrate is hardware locked at 115200 on this port.

I can create up to 4 VirtualComs with 4,5V I/O by using the code that I have posted.

On virtualCom number 0, I have connected the GPS. To check the GPS-signals, I forwarded the GPS-signal by converting it to characters before printing them to my console window by using "(char)data" in System.out println(); When I know that the GPS signals are OK, then I can remove the System.out.println(), and use the GPS-signal to controll the RC-car.

Since I'm supposed to use only GPRMC, do I need more than 100byte buffer? (Belived that the buffer would be cleared for each NMEA-line from the GPS)

Loocks bether after I removed all of the other lines, and only use GPRMC.

Created this program to calculate checksum (if anyone needs it):

public class GPSSum {

	public static void main (String args[])

	{

		String cmd = args[0];

		byte chksum=(byte)cmd.charAt(0);

		for (int i=1;i<cmd.length();i++)

		{

			chksum=(byte)((byte)chksum^((byte)cmd.charAt(i)));

		}

		String chkString=Integer.toHexString((int)chksum).toUpperCase();

		System.out.println("$"+cmd+"*"+chkString+"\r\n");

	}

}

Just run the class-file in command prompt with java in front and the string to create checksum in the back.

In example: X:\Documents\NetBeansProjects\GPSCruiser\build\classes>java GPSSum PSRF103,03,00,00,01

And you will get this back:

$PSRF103,03,00,00,01*27

Edited by ThaEagle

Share this post


Link to post
Share on other sites
Since I'm supposed to use only GPRMC, do I need more than 100byte buffer?

The buffer must be sufficiently large to hold ALL the data that is collected in it before you have a chance to empty it.

(Belived that the buffer would be cleared for each NMEA-line from the GPS)

You'll have to review the compiler docs to see what must occur to clear the buffer used in your vcom functions.

Share this post


Link to post
Share on other sites

The rest of the noise was some bugs on the interface between the muvium controller and my computer. Not between GPS and muvium. :)

By the way, 100bytes buffer is big enough since the stream ends at <CR><LF> and we still got some char left before the buffer is full. Even on the largest input from the GPS.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×