Pages: 1 [2] 3   Go Down
Author Topic: Can't read data from GPS module  (Read 3782 times)
0 Members and 1 Guest are viewing this topic.
Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the other report:
http://arduino.cc/forum/index.php/topic,74835.0.html

Quote
The client instance you refer to is an instance of Client, and its available() method is known to have issues.
Your version has issues. Mine no longer does.
http://arduino.cc/forum/index.php/topic,68624.0.html
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 616
Posts: 49441
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Here is the other report:
I've read that thread. You are the one that assumed that Serial.available() was not working.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

WE are the the ones that assumed. This was robtillaart in reply #1 of that topic.

Quote
Do you use Serial.Available() in your code (wild guess what could be the problem)
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 616
Posts: 49441
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
This was robtillaart in reply #1 of that topic.
Rob was asking IF OP was using Serial.available(). I don't see anywhere in his reply anything that suggests that Serial.available() was returning incorrect data.

If Serial.available() was not used, the problem that OP described could happen. So, it was reasonable to ask if Serial.available() was being used.

I don't see how you got from there to the assumption that Serial.available() might have a problem. It's a far simpler function than the Client.available() function, with much less opportunity for error.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@PaulS: Thanks for calling my attention to that other topic. I see new posts were there. I will respond there also in a few minutes.
The test I suggested there did not work. That means he cannot assume the Serial1.available() routine is broken. Only if blocking with my code 0xFF (it should be int type, and 0xFFFF) would straighten out the data stream, but it did not. There may be characters in the buffer, and something is interpreting them as 0xFF.

Nothing returned from a card swiper would be 0xFF. It's all ascii text.

Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 616
Posts: 49441
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Nothing returned from a card swiper would be 0xFF. It's all ascii text.
Can you make this assumption, without know how the data got on the card? Even if the data is supposed to be ASCII data, there is nothing that prevents an application from storing non-ASCII data, as long as the size of the data matches the size of the type that is supposed to be stored there.

Please don't think I'm picking on you. You do great work in a lot of threads, and help people I've lost patience with.
Logged

Miramar Beach, Florida
Offline Offline
Faraday Member
**
Karma: 147
Posts: 6040
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@PaulS: I don't think you are picking on me. I am rarely intimidated. I am just a bit aggressive, and I like my stuff not broken.
I appreciate your input. It always makes me think.  smiley

In the times I have swiped a credit/debit card as a test, I don't recall seeing any of the extended character sets. Maybe he is swiping something with 0xFF on it, but the OP has not mentioned that. It appears it is supposed to be ascii text. ??

And a GPS unit for sure is ascii. Right?

If this did not intimidate me, you won't. You should Google search "surfer tim destin florida". This is my favorite:
http://www.myhero.com/go/hero.asp?hero=Dicus_T_sjh_05_ul
« Last Edit: October 10, 2011, 07:34:30 am by SurferTim » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I`ll bet you need a MAX232 circuit..

Nothing is wrong with your code. But the electrical interface is wrong.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I took a shot of the oscilloscope screen, displaying what my simple circuit is doing to convert the signal.  



As you can see, it is working just as it should, first changing the -5v signal, then inverting the whole thing.  The output matches up with the input perfectly, so the signal should be getting through without a problem.  

Is there something else that I need to do to convert the signal from RS-232 to TTL serial?  
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually, this might be working.  I rewired everything, and I'm now getting what looks to be actual GPS data through this.  So, from initial appearances, the simple diode, resistor, and not gate converter does in fact work to convert RS-232 to TTL serial. 

I'm going to do a little more testing, and I'll report how it goes.  For now, here's  a shot of the data I'm getting in:

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, it works perfectly now.  I took the circuit outside so the gps could get a signal, ran it through the TinyGPS example code, and it started displaying my exact coordinates.  No failed checksums on the data from the GPS either, so it seems that the data is getting through cleanly.  

Thanks to everyone who posted advice.  

And, for future reference, if you do need to connect an RS-232 device to an arduino, if you can get the voltages scaled down to between 0v and 5v, and then invert that, you will get TTL serial data which the Arduino can use.  No MAX232 chip is required.  And, if the device is already putting out -5v and 5v serial data, all you need is a diode, a resistor, and a not gate(or nand gate with the inputs tied together).  

Hmm, I wonder if you could eliminate the NOT gate by simulating one on the arduino using an interrupt.  Would the arduino be fast enough to run that?  I'll have to give it a shot.  
« Last Edit: October 12, 2011, 11:07:12 pm by CompWiz17 » Logged

Smithfield, Rhode Island
Offline Offline
God Member
*****
Karma: 3
Posts: 843
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There is corrupted data in that screen shot. If you look closely you'll notice that there are extra end of line characters where they should not be. Between the $ and the end of the checksum ( thats the *XX ) there should be no line breaks.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, I did notice that.  I wonder why that's happening. 

Fortunately, it doesn't seem to be bothering the tinyGPS library. 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Actually, I did realize what's causing that.  

In the modified MultiSerialMega example I was using to test with, I had it insert a line break every 100 characters, so the garbled data didn't just run on forever on one line.  

So, it does seem to be working perfectly.  

Also, emulating a NOT gate on the Arduino(to eliminate having to include that in the circuit) does not seem to work.  I set up an interrupt to function as a NOT gate, but it didn't put out anything close to the signal that it should.  The arduino doesn't seem to be fast enough to do this.  I figured that that would be the case going in, but it was worth a shot to try it. 

I know this is probably really unlikely, but is there any way to tell the arduino to invert the serial data it receives before interpreting it?  
« Last Edit: October 15, 2011, 02:00:18 pm by CompWiz17 » Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9636
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I know this is probably really unlikely, but is there any way to tell the arduino to invert the serial data it receives before interpreting it?

Why, didn't you say the below when signal inversion was suggested?

The rs232 signal is already being inverted.  
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Pages: 1 [2] 3   Go Up
Jump to: