General TC > General TC Talk
Serial Port
MTCAT:
Hi everyone,
I bought a temperature sensor which when setup ahead of time on another machine, under the application of the next power up, acts as a virtual com port and simply outputs temperature readings in an ascii character string at 9600 bps.
It seems to work on my old TC 3.8.4 (kernel 2.6.33) except as soon as I try to look at the output of the port with;
--- Code: ---cat /dev/ttyACM0
--- End code ---
or with;
--- Code: ---microcom -s 9600 /dev/ttyACM0
--- End code ---
Everything seems okay, but when i Ctrl-C (in case of cat) or Ctrl-X (in case of microcom) my system returns in a very strange state; I do get the command prompt back but typing
--- Code: ---ls
--- End code ---
Returns nothing but an "Input/Output" error, and it seems that my filesystem is completely gone!!??
I am able to
--- Code: ---sudo poweroff
--- End code ---
And turn off gracefully (I hope) but I wonder if anyone has encountered this before and knows a possible solution? I also tried to install a python program "grabserial" but after installation of pyserial library, the program "grabserial" is not working at all, error codes of various types.
And strangely, after exiting "cat" or "microcom" typing "dmesg" doesn't show anything telling regarding this.
I did test the sensor on an even older distribution (2.6.21) on as ASUS EEE laptop and it seems to fully work in the sense that I can "cat /dev/ttyACM0" and I see the output strings just fine, and hitting "Ctrl-C" to exit "cat" the system is back to normal, no "lost" filesystem.
Any ideas as to what's going on with my TC 3.8.4 setup regarding this?
Thanks,
David
MTCAT:
Hi everyone,
Sorry for all my posting lately, but I think I (FINALLY) got this problem fixed!
After all the problems I've been having lately with the 4GB boot-stick and the temp sensors I guess I got impatient and changed a few things at once, so now I'm not sure which was the culprit but at least it's working now, I think anyway.
In the BIOS, firstly I disabled "ECHI handoff", this actually didn't do anything that I could tell, and then I;
1) In the BIOS, changed "Plug and Play OS" from No to Yes.
2) In the BIOS, under USB Device Management changed "Emulation" from "Auto" to "HDD".
3) I plugged the temperature sensor into a different port (probably irrelevant).
4) Ran the commands as su.
So now, typing
--- Code: ---sudo microcom -s 9600 /dev/ttyACM0 > test.log
--- End code ---
Works!, and even better, hitting Ctrl-X to exit, everything seems stable and normal afterwards! So must have been one of the BIOS settings that was causing me grief?
Now I'm trying to figure out how to add a time stamp to the log file, I tried;
--- Code: ---sudo microcom -s 9600 /dev/ttyACM0 | date > test.log
--- End code ---
And that didn't work at all, I might be able to get by w/o a time stamp there but would be nice to have.
Thanks for listening, and if anyone knows how to append a time onto the microcom output above, that would be great!
Thanks,
David
[Edit]: Fixed code tag. Rich
Rich:
Hi MTCAT
Try this:
--- Code: ---date > test.log; sudo microcom -s 9600 /dev/ttyACM0 >> test.log
--- End code ---
This should work too:
--- Code: ---sudo microcom -s 9600 /dev/ttyACM0 > $(date +"%y%m%d%H%M%S").log
--- End code ---
That should create a log file whose name is the date code that looks like:
--- Code: ---YYMMDDHHMMSS.log
--- End code ---
This creates a unique file every time it's run. In a directory listing they
would all be grouped together and sorted from oldest to newest.
MTCAT:
Hi Rich,
Thanks a lot for the help getting a timestamp into the log file, I'll give your suggestions a try next time I have the system up and running!
Thanks,
David
MTCAT:
Hi Rich,
Thanks for the help, I tried out your commands and they worked!, the first one adds the date and time at the very top of the logfile, and then the strings containing the temperature values roll in after that at once every predetermined interval, right now set to 5 seconds. The second way also worked with a nice title to the log file indicating the year/month/day and time as the name.
Not sure yet which would be best, I think method number one would be the easiest way of getting the temperature readings into the acquisition GUI (because we would be loading temp values from a file that always has the same name) but method number 2 would seem to be the most organized way of storing them for the future, if I wanted to look at the temp readings after the fact for example.
Good to have options though, thanks a lot!
I actually got the acquisition program running on the second receiver now!, what a milestone!, but I'm having write permission problems to the CF-card, I'll make a separate post for that.
Thanks again,
David
Navigation
[0] Message Index
[#] Next page
Go to full version