Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / [CLOSED]: Problem getting SoftwareSerial to work on: May 03, 2013, 09:48:12 pm
Does the Garmin use TTL (5V) Serial or RS232?  The logic levels would be inverted if you tried to connect an RS232 signal to an Arduino TTL Serial input.  That would produce strange results.


You hit the nail on the head with this answer John. I found a tutoral on the Arduino site (which I can not find now) and breadboarded a MAX232 chip. After a little tweaking of the code I got exatcly what I was expecting.

Thanks for your time and effort.
Craig
2  Using Arduino / Programming Questions / Re: Problem getting SoftwareSerial to work on: April 30, 2013, 11:13:50 pm
Does the Garmin use TTL (5V) Serial or RS232?  The logic levels would be inverted if you tried to connect an RS232 signal to an Arduino TTL Serial input.  That would produce strange results.


I did not know that there was a difference. The Garmin uses RS232. Looking at the binary results it does not look like a simple inversion. However I guess that the stop bit would also be inverted. Also the correct string contains 440 bit and the corrupt ones has 464.

Would this also mean that using the hardware serial chip on pins 0 and 1 would also fail?

If this is the problem is there any easy way to find out. Or will I need to build a RS232 to TTL converter like this one
http://www.google.co.nz/imgres?imgurl=http://www.valerioriva.it/wp-content/circuit_232.jpg&imgrefurl=http://www.valerioriva.it/2009/06/rs232-ttl-logic-converter/&h=299&w=392&sz=24&tbnid=fyy0lqGALI9HtM:&tbnh=85&tbnw=111&zoom=1&usg=__4f1pRtZufUXWn_fy6XS-ZQOv1Fw=&docid=r6CprWhAboMBzM&sa=X&ei=u5OAUfuhEIyMkgWuqYHgCw&ved=0CC4Q9QEwAw

 
3  Using Arduino / Programming Questions / Problem getting SoftwareSerial to work on: April 30, 2013, 07:38:24 pm
Hello All

I have just started on a serial communication project and have an issue which I need some help with. Most likely it is at a fundamental level.

My platform is - Eleven (100% Arduino Uno Compatible) not user what revision.
I am using IDE version 1.0.4

For initial debugging I am use a Garmin GPS 72 in simulator mode, as a source of serial data. This provides me with a constant stream of serial data in a known format. I have set up the GPS to send “Text Out” at “4800” Baud and I get the following data when I use putty and a Serial to USB converter:

@130427060050S9944449E99943537S015+00025E0000N0000U0000
@130427060051S9944449E99943537S015+00025E0000N0000U0000
@130427060052S9944449E99943537S015+00025E0000N0000U0000
@130427060053S9944449E99943537S015+00025E0000N0000U0000
@130427060054S9944449E99943537S015+00025E0000N0000U0000
@130427060055S9944449E99943537S015+00025E0000N0000U0000
@130427060056S9944449E99943537S015+00025E0000N0000U0000

Where only the time changes.

I got data above by:

1) Connecting a laptop and GPS together with a USB to Serial converter
2) Using Putty set to 8 (bits) No (parity) 1 (stop bit) XON/XOFF (flow control) at 4800 baud

Then I uploaded the following code to my Arduino. This is based in the Software Serial example code:
Code:
/*
Receives from software serial, sends to hardware serial.
The circuit:
* Arduino RX is digital pin 10 - connect to TX of GPS 72 Brown, Pin 2 of DB 9   (Green)
* Arduino TX is digital pin 11 - connect to RX of GPS 72 White, Pin 3 of DB 9  (Red)
*/

#include <SoftwareSerial.h>

#define rxPin 10
#define txPin 11
SoftwareSerial GarminSerial =  SoftwareSerial(rxPin, txPin);

int  counter=0;
char  CharFromGPS;
void setup() 
{
 Serial.begin(4800);
 Serial.println("It's Alive!");

 pinMode(rxPin, INPUT);
 pinMode(txPin, OUTPUT);
 GarminSerial.begin(4800);
}

void loop() // run over and over
{
  if (GarminSerial.available())
    Serial.write(GarminSerial.read());
}

My problem is that I get nothing like the output from Putty

The output I get on the Serial Monitor is: (casting the output to int)
117-101-251-187-182-22-246-54-86-150-182-214-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-245-246-246-246-86-183-15-0-

117-101-251-187-182-22-246-54-86-150-150-246-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-245-246-246-246-86-183-15-0-

117-101-251-187-182-22-246-54-86-150-150-214-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-245-246-246-246-86-183-15-0-

117-101-251-187-182-22-246-54-86-150-150-182-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-245-246-246-246-86-183-15-0-

This look almost like ASCII codes, by do not translate to correct text output.

So I have a fundamental error somewhere in my setup.

This gives the correct output:
Garmin-> serial cable -> serial 2 USB converter -> laptop USB port -> putty

This gives the incorrect output
Garmin-> serial cable -> GND to GND, TX on Garmin to Arduino RX pin 10

I original posted this in the devices forum but this is probably a better place for it.

Happy to try anything to get this to work.
4  Using Arduino / Networking, Protocols, and Devices / Re: Problem/Question about receiving serial communication from Garmin GPS on: April 29, 2013, 03:14:41 am
Excellent point mauried
Quote
Software Serial uses the CPU to calculate the timing of the bits , so it can either receive or transmit but not both at the same time.
When you are transmitting a character, any incoming characters will be lost
So I reworked my code to capture the GPR output into a buffer and then printed it out.
Code:
/*

Receives from software serial, sends to hardware serial.

The circuit:

* RX is digital pin 10 - connect to TX of GPS 72 Brown, Pin 2 of DB 9   (Green)

* TX is digital pin 11 - connect to RX of GPS 72 White, Pin 3 of DB 9  (Red)

*/

#include <SoftwareSerial.h>
#define rxPin 10
#define txPin 11

SoftwareSerial GarminSerial =  SoftwareSerial(rxPin, txPin);
int  counter=0;
int  index1=0;
int  index2=0;

char CharFromGPS;
char GPSString[50];

void setup() 
{

 Serial.begin(115200);
 Serial.println("It's Alive!");

 pinMode(rxPin, INPUT);
 pinMode(txPin, OUTPUT);

 GarminSerial.begin(4800);
 delay(100);
 GarminSerial.listen();
}

void loop()
{

 for (index1 = 0; index1 < 50; index1 = index1 + 1) {
    GPSString[index1] = 0;
 }

 for (index1 = 0; index1 < 50; index1 = index1 + 1) {
    CharFromGPS = GarminSerial.read();
    GPSString[index1] = CharFromGPS;
 }

 for (index1 = 0; index1 < 50; index1 = index1 + 1) {
    Serial.print(GPSString[index1]);
    Serial.print("-");
 }

 Serial.println("**");

 counter++;
 if(counter == 10){
    counter=0;
    delay(5000);
 }
}

However I don’t think this is the whole story. I am still getting the same output.  ( the double ** where added to show the end of the buffer)


117-101-251-187-182-214-246-22-150-246-86-150-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-**

245-246-246-246-86-183-15-0-117-101-251-187-182--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1-**

117-101-251-187-182-214-246-22-150-246-86-214-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-**

245-246-246-246-86-183-15-0-117-101-251-187-182--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1-**

117-101-251-187-182-214-246-22-150-214-246-118-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-**

245-246-246-246-86-183-15-0-117-101-251-187-182--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1--1-**

Does anyone have any more suggestions?
5  Using Arduino / Networking, Protocols, and Devices / Problem/Question about receiving serial communication from Garmin GPS on: April 27, 2013, 10:45:31 pm
Hello All

I have just started on a serial communication project and have an issue which I need some help with. Most likely it is at a fundamental level.

For initial debugging I am use a Garmin GPS 72 in simulator mode, as a source of serial data. This provides me with a constant stream of serial data in a known format. I have set up the GPS to send “Text Out” at “4800” Baud and I get the following data:

@130427060050S9944449E99943537S015+00025E0000N0000U0000

@130427060051S9944449E99943537S015+00025E0000N0000U0000

@130427060052S9944449E99943537S015+00025E0000N0000U0000

@130427060053S9944449E99943537S015+00025E0000N0000U0000

@130427060054S9944449E99943537S015+00025E0000N0000U0000

@130427060055S9944449E99943537S015+00025E0000N0000U0000

@130427060056S9944449E99943537S015+00025E0000N0000U0000

Where only the time changes.

I got data above by:

1) Connecting a laptop and GPS together with a USB to Serial converter

2) Using Putty set to 8 (bits) No (parity) 1 (stop bit) XON/XOFF (flow control) at 4800 baud

Then I uploaded the following code to my Arduino. This is based in the Software Serial example code:
Code:
/*

Receives from software serial, sends to hardware serial.

The circuit:

* Arduino RX is digital pin 10 - connect to TX of GPS 72 Brown, Pin 2 of DB 9   (Green)

* Arduino TX is digital pin 11 - connect to RX of GPS 72 White, Pin 3 of DB 9  (Red)

*/

#include <SoftwareSerial.h>

#define rxPin 10

#define txPin 11

SoftwareSerial GarminSerial =  SoftwareSerial(rxPin, txPin);

int  counter=0;

char  CharFromGPS;

void setup() 

{

 Serial.begin(115200);

 Serial.println("It's Alive!");

 pinMode(rxPin, INPUT);

 pinMode(txPin, OUTPUT);

 GarminSerial.begin(4800);

}

void loop()

{

 GarminSerial.listen();

 counter++;

 CharFromGPS = GarminSerial.read();

 if( CharFromGPS != -1 ){

    Serial.print((char)CharFromGPS);    // The variable casting is only debugging

//    Serial.print((int)CharFromGPS);    // The variable casting is only debugging

    Serial.print("-");

 }

 if(counter >= 3000 ){

    counter=0;

    delay(3000);

 }
}

My problem is that I get nothing like the output from Putty

The output I get on the Serial Monitor is: (casting the output to int)

117-101-251-187-182-22-246-54-86-150-182-214-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-245-246-246-246-86-183-15-0-

117-101-251-187-182-22-246-54-86-150-150-246-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-245-246-246-246-86-183-15-0-

117-101-251-187-182-22-246-54-86-150-150-214-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-245-246-246-246-86-183-15-0-

117-101-251-187-182-22-246-54-86-150-150-182-150-149-54-118-118-118-118-214-86-117-69-187-187-150-86-150-22-150-245-214-86-150-246-246-246-182-86-86-125-125-251-251-54-245-246-246-246-86-245-246-246-246-86-183-15-0-


This look almost like ASCII codes, by do not translate to correct text output.

So I have a fundamental error somewhere in my setup.
This gives the correct output

Garmin-> serial cable -> serial 2 USB converter -> laptop USB port -> putty

This gives the incorrect output

Garmin-> serial cable -> GND to GND, TX on Garmin to Arduino RX pin 10

There are no pull up resistors

Do I need to use Arduino pins 0 and 1. If so how can I monitor the GPS output and use the USB serial port to monitor program?



Thanks for the time and effort
Craig
Pages: [1]