LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-17-2009, 09:52 AM   #1
ljkenny
LQ Newbie
 
Registered: Apr 2009
Posts: 13

Rep: Reputation: 0
Serial issues on an embedded Linux platform


I've written an application which deals with NMEA sentences for my 5HZ GPS module.

It worked for a while, but now it doesn't.

When I run the GPS module through Minicom I receive the correct results:
Code:
$GPVTG,51.99,T,,M,0.48,N,0.88,K,A*05                                            
$GPGGA,133837.000,5130.9991,N,00232.4986,W,1,7,1.01,68.2,M,48.9,M,,*72          
$GPRMC,133837.000,A,5130.9991,N,00232.4986,W,0.53,51.99,170409,,,A*47           
$GPVTG,51.99,T,,M,0.53,N,0.97,K,A*01                                            
$GPGGA,133837.200,5130.9991,N,00232.4985,W,1,7,1.01,68.2,M,48.9,M,,*73          
$GPRMC,133837.200,A,5130.9991,N,00232.4985,W,0.51,51.99,170409,,,A*44           
$GPVTG,51.99,T,,M,0.51,N,0.94,K,A*00                                            
$GPGGA,133837.400,5130.9991,N,00232.4985,W,1,7,1.01,68.2,M,48.9,M,,*75          
$GPGSA,A,3,08,04,25,02,10,24,13,,,,,,1.37,1.01,0.92*00                          
$GPGSV,3,1,11,07,61,116,,25,54,073,19,02,48,240,35,13,45,065,18*70              
$GPGSV,3,2,11,08,39,175,17,10,38,296,39,04,29,193,25,23,14,070,*72              
$GPGSV,3,3,11,24,11,324,21,16,10,027,,29,09,321,*48                             
$GPRMC,133837.400,A,5130.9991,N,00232.4985,W,0.60,51.99,170409,,,A*40           
$GPVTG,51.99,T,,M,0.60,N,1.11,K,A*0E
So I'm happy that everything is working correctly from the GPS module to the end of the serial cable.

However when I run it on my development board, I receive mostly garbage.
Code:
fORGSV,;.:,qs.q0nvr,��i+�7�5sn�v7<>1<,:=-3{r.2;-2<-9,OXRMSn1;6�99n<84,I,=1sA
6W�GS��s<sl31n2sn9p<0w2.,r;,19�397,����v-8:n�rs<*�w
$GPRMC,134911.600,A,5130.9997,N,00232.5056,W,0.00,51.99,170409,,,A*46
$GPVTG,51.99,T,,M,0.00,N,0.00,K,A*09
$GPGGA,134911.800,5130.9997,N,00232.5056,W,1,7,1.22,66.2,M,48.9,M,,*74
$GPRMC,134911.800,A,5130.9997,N,00232.5056,W,0.00,51.99,170409,,,A*48
$GPVTG,51.99,T,,M,0.00,N,0.00,K,A*09
&GtggE,n&ڊ�v���t,Ol&d����fv.006&�����b���f�f��nv7$v6.2lD,<<.=,M,,.7e       9
�4GROOAlssv�srn6�8l=9;8.999?-O,8prs25rw�nW-q,7n1n:rn�R.�~O�vz>{.].nj7BC#�V 7
RG�O�V<3l3n11,3s.11,�7�nn2{<r9n{9?l22nsR-0x��K%OOC!YV��]Cn334{1r�5p0,I,53s�?
I wouldn't mind so much if it printed garbage ALL the time, but it doesn't.

Every now and again it churns out perfectly viable data.

I am running Linux and a bare-bones system i.e. compiled kernel and Busybox on my Olimex EP9302.

I have been playing around with the getty settings in /etc/inittab, but to no avail.

I've tried each of these:
Code:
console::respawn:/sbin/getty -L 38400 /dev/ttyAM1 vt100

console::once:/sbin/getty -L 38400 /dev/ttyAM1 vt100
console::once:/sbin/getty -L 38400 /dev/ttyAM1 vt102

getty -L -n 38400 /dev/ttyAM1 vt100
getty -L -l /home/username/null_login 38400 /dev/ttyAM1 vt102
Some work better than others, some do not work at all.

As I say, it's very annoying because all this worked not long ago and I can't think what I might have changed to upset it.

Does anyone have any ideas to poke me in the right direction, for I'm all out!
 
Old 04-17-2009, 06:09 PM   #2
jf.argentino
Member
 
Registered: Apr 2008
Location: Toulon (France)
Distribution: FEDORA CORE
Posts: 493

Rep: Reputation: 50
not totally sure, you didn't run minicom from your development board, isn't it? If so try to run it from your development board. If minicom print garbage char too, maybe there's a hardware problem on the UART.

Try to check NMEA checksum, to be sure it's not the console displaying...

If there's parity check (but I don't think so in NMEA format), enable it to with "set_iflag (port, IGNPAR, 0)".

Pull and shake the cable since a bad connection is possible too.
 
Old 04-17-2009, 07:33 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
This looks like a hardware problem.

Either the cable, voltage levels, grounding or the UART, OR the clock rate is off.

In the early days we used to have crystals on the board which sometimes started to oscillate in 3rd overtone, and that made all clock frequencies off by a factor 3.

Try to compare the ASCII codes from erraneous bytes or characters against the characters which should have been received. Maybe you can discover a pattern, for example, the 7th bit is always high, or instead of 01010101 the character you received is 10101010 (start bit problem) or 00110011 (clock problem)

It is about as much fun as sudoku.

jlinkels
 
Old 04-18-2009, 01:53 AM   #4
ljkenny
LQ Newbie
 
Registered: Apr 2009
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jf.argentino View Post
not totally sure, you didn't run minicom from your development board, isn't it? If so try to run it from your development board. If minicom print garbage char too, maybe there's a hardware problem on the UART.

Try to check NMEA checksum, to be sure it's not the console displaying...

If there's parity check (but I don't think so in NMEA format), enable it to with "set_iflag (port, IGNPAR, 0)".

Pull and shake the cable since a bad connection is possible too.
This is a much more productive reply from yourself, thank you!

No, I didn't run Minicom from the development board, it wouldn't be able to support it.

I have, however, run Microcom and the same issue surfaces.

I'm reasonably certain that my application is sound anyway; as I have compiled an x86 version which works swimmingly on my development machine.

With regard to the NMEA sentence, it does provide a checksum and I do check for it, but it fails.

No parity checking unfortunately.

Quote:
Originally Posted by jlinkels View Post
This looks like a hardware problem.

Either the cable, voltage levels, grounding or the UART, OR the clock rate is off.

In the early days we used to have crystals on the board which sometimes started to oscillate in 3rd overtone, and that made all clock frequencies off by a factor 3.

Try to compare the ASCII codes from erraneous bytes or characters against the characters which should have been received. Maybe you can discover a pattern, for example, the 7th bit is always high, or instead of 01010101 the character you received is 10101010 (start bit problem) or 00110011 (clock problem)

It is about as much fun as sudoku.

jlinkels
I like Sudoku! =;-)

After further investigation, I'm fairly sure this issue lies in the configuration of the UART's AMBA driver.

Depending on how I call getty in inittab has a huge effect on just how much of the sentence is displayed as it should be.

Since this issue, I have installed serial->USB->serial drivers within the kernel - things are looking up. =:-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for an embedded wireless device platform NedRyerson Linux - Embedded & Single-board computer 2 01-21-2009 11:14 AM
Gui App language for embedded platform? PatM Linux - Software 3 05-10-2008 08:11 PM
LXer: Com One Phoenix Wi-Fi radio rises from embedded Linux platform LXer Syndicated Linux News 0 02-29-2008 04:20 PM
LXer: Timesys Webinars to Address Key Embedded Linux Development Issues LXer Syndicated Linux News 0 02-22-2006 06:31 AM
Serial Comm for J2me/CDC on embedded Linux moeminhtun Programming 0 01-24-2003 04:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration