Why “sudo cat /dev/ttyACM0” run only 1 time? (GPS)

In summary, the GPS data collection expert is requesting help from anyone who has worked on the u-blox GNSS Evaluation Kit Time EVK-M8T before. When he has good set up, he type the command `sudo cat /dev/ttyACM0' and it shows the NMEA messages but suddenly it stopped running. When he tried to run it again, it worked when he mechanically unplugged and connected the USB cable. However, it stopped running again without touching anything. When he tried to run it again, it ran for a few seconds before it stopped. When he tried to run it again, it worked when he started it with the command `sudo cat /dev
  • #1
Nate Duong
126
3
hi group,

I am working on the GPS data collection, I Need help. If anyone who has been working on the u-blox GNSS Evaluation Kit Time EVK-M8T before and have seen it, please help.
I do not know why sudo cat /dev/ttyACM0 only 1 time.

I have the U-blox EVK-M8T which can read the NMEA messages through the Ubuntu terminal window. When I have good set up, and type the command `sudo cat /dev/ttyACM0, it show me the NMEA meassages, such as:

$GLGSV,3,3,09,87,06,340,*52
$GNGLL,,,,,140236.00,V,N*56
$GNZDA,140236.00,10,03,2017,00,00*7C
$GNRMC,140236.85,V,,,,,,,100317,,,N*68
$GNVTG,,,,,,,,,N*2E
$GNGGA,140236.85,,,,,0,00,99.99,,,,,,*77
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*2E
$GNGSA,A,1,,,,,,,,,,,,,99.99,99.99,99.99*2E
$GPGSV,3,1,12,10,76,330,52,11,03,322,44,12,23,100,47,14,32,270,44*7E
$GPGSV,3,2,12,15,10,077,,18,70,123,46,20,02,130,47,21,22,189,47*73
$GPGSV,3,3,12,24,40,050,49,25,16,142,39,31,13,211,48,32,52,288,50*72
$GLGSV,3,1,09,69,26,096,28,70,62,024,37,71,30,315,29,73,37,171,36*6A
$GLGSV,3,2,09,79,20,030,,80,64,095,31,85,09,235,27,86,20,287,33*62
$GNGLL,,,,,140236.85,V,N*5B
$GNZDA,140236.85,10,03,2017,00,00*71

but suddenly, it stopped running without touching anything, I did not know why, and I tried to run again but it did not run. Until, mechanically unplug USB cable and connect a gain, it worked.

it happened again again and again...

Does anyone know what is going on?

Thank you.
 
Engineering news on Phys.org
  • #2
Nate Duong said:
I do not know why sudo cat /dev/ttyACM0 only 1 time.
I know nothing about your GPS data stuff. But if you are cat'ing a file the process will run until it encounters EOF. If your tty device does not send an EOF character then the cat process will just wait patiently for more data from that tty. So I think you are seeing the process run and not terminate, but you don't realize it. It is not terminating until you unplug things and ungraciously cause it to be killed.

Does that sound to be what's happening?
 
  • #3
NascentOxygen said:
ungraciously
maybe it is true, because when it stops running on the Ubuntu terminal window, but the LED light of the device is still blinking every 1 second.

If you know something about it, can you tell me how to save those data into text file or dat file...

Thank you.
 
  • #4
NascentOxygen said:
So I think you are seeing the process run and not terminate, but you don't realize it. It is not terminating until you unplug things and ungraciously cause it to be killed.

Kudos. That is exactly the kind of hypothesis that is the essence of effective software troubleshooting Think of a scenario that matches the evidence.
 
  • #5
How quickly does it take for that complete data read, just a second or two?

You could start an asynchronous process that waits for sufficient time for cat to complete, then kills your cat.

In place of cat, consider dd as a utility to copy the device data to a file. dd has unusual syntax, so man dd
 
  • #6
NascentOxygen said:
How quickly does it take for that complete data read, just a second or two?

You could start an asynchronous process that waits for sufficient time for cat to complete, then kills your cat.

In place of cat, consider dd as a utility to copy the device data to a file. dd has unusual syntax, so man dd

I think 1 second gives me info. of the list which I posted above, and every second gives update of value of the list.

And I do not understand how to kill cat, and man dd.

Could you please give me in a little detail, so i can understand.

Thank you very much.
 
  • #7
'man' is the linux online manual, it returns documentation on linux commnds
man kill
man dd

Then google and look for examples in shell scripts where these are used.
 
  • #8
Nate Duong said:
$GLGSV,
$GNGLL,,,,,
$GNZDA
I know nothing about GPS data. Does one of these 'words' indicate the end of your block of useful data? If so, it might be sufficient for your shell script to loop through reading and writing each line to a file until it finds that end word, then exiting the shell script. This approach would be simpler, and you'd not need to use kill.

The shell command for reading one line is: read -r

Is this problem part of some exercise or homework in your studies?
 
  • #9
Wait, I'm confused, what do you expect cat to do? Cat doesn't stick around, it dumps the file and then closes.

Do you mean to use "tail -f"?
 
  • #10
I was a little surprised that cat did seem to be waiting. Poster can easily check if it is using: ps
 

FAQ: Why “sudo cat /dev/ttyACM0” run only 1 time? (GPS)

Why does the command "sudo cat /dev/ttyACM0" only run once when trying to access GPS data?

The "sudo cat /dev/ttyACM0" command is used to read data from the serial port, which is where the GPS data is being transmitted. However, this command can only be used to read data once as it does not continuously listen for data. A continuous monitoring process or a script would need to be used to continually read and process the GPS data.

Is there a specific reason why the command "sudo cat /dev/ttyACM0" is limited to one run?

The limitation of the "sudo cat /dev/ttyACM0" command to only one run is due to the way it is designed. This command is meant to be used for one-time reading of data from the serial port, and not for continuous monitoring.

Can the "sudo cat /dev/ttyACM0" command be used to read data multiple times?

No, the "sudo cat /dev/ttyACM0" command cannot be used to read data multiple times. As mentioned before, this command is meant for one-time reading of data from the serial port. To continuously read GPS data, a different method would need to be used.

Are there any alternatives to the "sudo cat /dev/ttyACM0" command for reading GPS data?

Yes, there are alternative methods for reading GPS data. One option is to use a programming language like Python to write a script that can continuously read and process the data from the serial port. Another option is to use a specific GPS data reader program that is designed for this purpose.

Is there a way to modify the "sudo cat /dev/ttyACM0" command to continuously read GPS data?

No, the "sudo cat /dev/ttyACM0" command cannot be modified to continuously read GPS data. As mentioned before, it is not designed for continuous monitoring. Using a different method, such as a script or specialized program, would be necessary for continuous reading of GPS data.

Back
Top