Some help with the BASIC Stamp on Linux please.
Lich
Posts: 4
Hello everyone,
I'm having a little difficulty using the Stamp under Ubuntu Linux 7.10.
Let me tell you what I have done so far, and where my resources came from. I hope someone here is able and gracious enough to assist me.
First of all, I downloaded the bstamp-2006.05.31.tar.gz file from sourceforge. I also downloaded tokenizer.so.
So the first question is, is this all I need?
Moving on, I extracted the .tar.gz package, which created a directory named bstamp on my desktop. Using terminal and navigating to this directory, I typed;
make
and then;
sudo make install
The next thing I did was to create a link from both ttyUSB0 and usb1 to bstamp. I did this via the terminal like this (after navigating to the /dev directory;
ln -s ttyUSB0 bstamp
ln -s usb1 bstamp -after hitting enter after this line, the message "file exists" came up.
Then I copied the tokenizer.so to /usr/local/lib/libbstamptokenizer.so
In terminal I ran bstamp_tokenize which must have been a success I guess, because in the terminal "PBasic Tokenizer Library version 1.23" come up and I can begin typing....
Next question, what the heck do I do from here?
I was shotgunning it and tried piping it based on what I read at sourceforge. Below is my input and the resultant errors:
Third question:
Is someone available here who has good knowledge of running the stamp on Linux, who could maybe walk me through this step by step. I know a windows version would be easier and I've run stamp under windows successfully before, but I have Linux at home and have been released from college early due to taking a job in my industry of study. I need to do some stamp projects however as a condition of the release, and so it is quite important that I am able get this working...
If anyone would / could assist me, I'd be willing to compensate you for your time.
Post Edited (Lich) : 3/2/2008 8:47:15 PM GMT
I'm having a little difficulty using the Stamp under Ubuntu Linux 7.10.
Let me tell you what I have done so far, and where my resources came from. I hope someone here is able and gracious enough to assist me.
First of all, I downloaded the bstamp-2006.05.31.tar.gz file from sourceforge. I also downloaded tokenizer.so.
So the first question is, is this all I need?
Moving on, I extracted the .tar.gz package, which created a directory named bstamp on my desktop. Using terminal and navigating to this directory, I typed;
make
and then;
sudo make install
The next thing I did was to create a link from both ttyUSB0 and usb1 to bstamp. I did this via the terminal like this (after navigating to the /dev directory;
ln -s ttyUSB0 bstamp
ln -s usb1 bstamp -after hitting enter after this line, the message "file exists" came up.
Then I copied the tokenizer.so to /usr/local/lib/libbstamptokenizer.so
In terminal I ran bstamp_tokenize which must have been a success I guess, because in the terminal "PBasic Tokenizer Library version 1.23" come up and I can begin typing....
Next question, what the heck do I do from here?
I was shotgunning it and tried piping it based on what I read at sourceforge. Below is my input and the resultant errors:
In Terminal said...
mitch@mitch-laptop:~/Desktop/bstamp$ sudo cat hello.bs2 | bstamp_tokenize | bstamp_run
PBASIC Tokenizer Library version 1.23
Error: Could not open /dev/bstamp for reading/writing!
cat: hello.bs2: No such file or directory
Error: Tokenization of (null) failed.
Failed compile: 156-Unknown target module. $STAMP directive not found
The following text gave the error: mitch@mitch-laptop:~/Desktop/bstamp$ bstamp_tokenize
Third question:
Is someone available here who has good knowledge of running the stamp on Linux, who could maybe walk me through this step by step. I know a windows version would be easier and I've run stamp under windows successfully before, but I have Linux at home and have been released from college early due to taking a job in my industry of study. I need to do some stamp projects however as a condition of the release, and so it is quite important that I am able get this working...
If anyone would / could assist me, I'd be willing to compensate you for your time.
Post Edited (Lich) : 3/2/2008 8:47:15 PM GMT
Comments
I don't know how much experience you have with Linux or Unix, but people get tripped up all the time with directory structures. (or at least I do)
Everything that you need is in the tarball that you downloaded.
Your attempt to pipe indicated at least one problem with the path. "cat" couldn't find the hello.bs2 program, and it will be in a directory called "pbasic_example" (or something like that; I can't say precisely because I rm'd mine some time ago) Look for it in bstamp... Mine is set up like this:
The tokenizer and "run" programs are in /usr/local/bstamp
The examples would have been in /usr/local/bstamp/pbasic_examples
Stamp programs can be written in any text editor; I happen to use "gedit". You won't get any help with syntax and capitalization, 'cause no Unix or Linux editor will know anything about pbasic; it does force you to learn well <smile>
After the program is written, ti can be tokenized. Again, the path name needs to be carefully spedlled out, or you run the risk of the tokenized version vanishing... the tokenizer does NOT automatically add the .tok suffix, by the way and it isn't needed, but is a good way to keep things organized.
bstamp_run is the utility that actually loads the .tok file into the Stamp. Any errors before this are usually Linux issues and not Stamp issues.
Piping from the tokenizer to bstamp_run does work if all of the paths are correct.
The only actual problems that I have found (so far) is that the tokenizer does NOT support the BS2px. Also bstamp_run does not support the BS2pe that I am using. Bstamp_run can easily be modified to support newer versions of Stamps, which I did, and it now works.
I am no expert, by any means, but I do tinker a lot...
Regards,
Terry
I think I might see what's happening... maybe. I'll keep you posted...
I can adjust to that, but as you can see, I get hung up on some obvious items.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PLEASE CONSIDER the following:
Do you want a quickly operational black box solution or the knowledge included therein?······
Post Edited (Kramer) : 3/4/2008 2:23:15 PM GMT
Yes, please keep us posted... 'cause it should work. I've got it on two different computers (I know, that's no guarantee!)
THE trouble with Linux is that it expects the user to know what he (or she) is doing; the trouble with Windows is that it doesn't allow the user to think. I want a happy medium, wherein the system knows (and does) what I meant instead of what I told it.
Have fun,
Terry
Since Linux is an off-shoot of Unix, I do understand what 'pipes' are and that one has to be careful to have rights to modify and open new files in the appropriate places for all this to work. MS-DOS never implimented such detailed rights as it was for a 'personal computer', not a multi-user system.
In many ways, it is like going back to MS-DOS as things are done more in a Command Line type of interface. So, I'll have to dust up on file extentions, piles, and such. It is good discipline.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PLEASE CONSIDER the following:
Do you want a quickly operational black box solution or the knowledge included therein?······
Nearly all that you learned then is still valid. The Unix/Linux community is fairly slow to implement changes, and slower to drop support for old functions. My biggest problem seems to be with file structure. I find certain operational files in one directory, and 2 versions later I discover that my distributor (issuer of the distro) has moved them to somewhere different.
I'm not real fond of SELinux either.
I can use pipes, and have written a couple, but only really understand the one used in shell scripting.
Terry
One thing that puzzles me is that my Xandros Linux appears to be in ROM. I have no CD to reboot if corrupted and AsusEEE is not to clear about access to the lower levels of it. So, I've been reluctant to change too much until I have greater clarity on how to care for and maintain what I've got. I do know that Defragment is unneeded in Linux; I have located a feature to clear clutter of temporary files; I have Anti-virus software; but I am not too sure about anything else. At home, I logon behind a firewall within my router, but when I use Wifi, I am a bit unsure if I should be worrying.
I can find answers myself with good text, but English computer books have all but disappeared from Kaohsiung - everything is translated to Chinese. So it is hard to shop.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PLEASE CONSIDER the following:
Do you want a quickly operational black box solution or the knowledge included therein?······
I would imagine that, on your machine, the OS does appear in ROM or EEPROM (probably a mix). That might make it difficult to update or to switch to Windows. I expect that there is EEPROM devoted to user-supplied routines, and modifications will have to live as add-ons.
As for anti-virus precautions, Wi-fi appears to be a vulnerable area. The hot-spot operator, be it a hotel, or the company doing rest areas, or whatever, is going to have the best shot at stopping such things. And who knows if he is? I would think, however, that an OS living in EEPROM would be far less subject to corruption than a disk-based system.
I rather suspect that users' groups are springing up all over the Web, given the seeming popularity of your box, and that should be a great source for information. It does take time to winnow the wheat from the chaff...
Have fun,
Terry
Anyway, here's the situation.
After I tokenize a program, I try to run it via the ./bstamp_run PROGRAM.tok command. I keep getting two errors. One is the Basic Stamp could not be opened for reading / writing. The second error is No Basic Stamp found. Perhaps the bstamp is not connected or not compatible.... The first error I think I have solved. It seems that every time you disconnect the stamp and shut off your computer, the symbolic link you create between bstamp and the device (ie, usb1, ttyS0, whatever...) is broken and you have to recreate that link. The second error baffles me. That second error was received both when the stamp was connected and after I unplugged it. This led me to believe that the serial to usb cable was bad. Checking it on a meter though, revealed there is continuity. So I think it's a driver issue. Then again, we tried it with a regular serial port on a desktop PC with Windows (expletive)sta... I mean Vista Home premium... and it worked fine. But then for a straight serial to serial connection, you don't need a driver for the cable.
I'm baffled.
It also seems at one point I was able to send one program through, because at one point I ran a simple debug "hello world" program, and a small servo test program too. When I fire up the stamp, if the servo is connected, it runs this program by itself because that program is presumably stored in the Stamp. Is that feasible? I haven't done anything different between then and now, so maybe that leads me back to the cable. Perhaps that IC in the cable which carries out the serial / usb conversion is shot? I have radio shack ordering me another cable, and it will be in within a day or two. We'll see. In the meantime, I'm going to treat this as a driver issue and troubleshoot that end.
If anyone has input, jump on in. I'm no smarter than anyone else here, and would be grateful for any input.
You do have to re-create the link every time that you turn on the computer (I thought that was an idiosyncrasy of my distro) My work-around is to put a shell script in the "local.rc" It will run on boot-up. You probably need to open the permissions for /dev//ttyS0 as well. I'm running on a PC, totally under my control, so I just set them to wide open for that port... but that wouldn't give you the error that you are seeing.
Let's see: it works under Windows, so the cable is good and the USB-adapter is good. So, for USB-to-serial I would agree that the drive could easily be a problem. I'm told that the Vista driver won't work with the FTDI adapter, by the way, so the Linux driver probably won't work with it either.
Can you try it on a straight serial port, in order to see if you can get it to work in Linux at all?
As for a program being stored in the Stamp, indeed, it is feasible, and very useful. When things are operating normally, I run a "clear" program before I quit for the day, leaving all of the pin assignments in a known state, and not getting surprises when I turn on the Stamp next time.
I highly doubt that it is a cable issue, especially if you can get it to work under Windows. But wait, are you treating the cable and the USB-serial adapter as one unit?
Again, if the cable and the adapter work under Windows, they are good, but the driver could still be suspect...
Regards,
Terry
I'm replying to Kramer in your thread 'cause he asked the question here. Please don't take it amiss...
Kramer,
This is the promised addition to the book list.
Linux Secrets (a newer copy than mine would be better, but I keep a lot of stickies in it)
I have Peter Norton's book on Linux bu don't like it much.
Running Linux (an O-Reilly book) - copyright 1995 again, a newer version would be better
A book that covers the shell that you are using (I assume that Asus didn't provide more than one) I have an O'reilly book on bash (the Bourne shell in Linux clothing)
I also several books on C++ and perl, perl 'cause I like it, and C++ 'cause it and Linux are inextricably related.
Regards,
Terry
Let me back up a step. I said in my first post that I'd successfully run the stamp with windows before, but not with this particular USB to Serial cable. I ran the stamp successfully on laptops at the college I recently attended under Win XP, and the cables were available there. I got this serial to USB cable from radio shack, and the driver CD which accompanies it has - you guessed it correctly- a driver that is no good on Vista. I hunted all over and found one on the Internet, and now the stamp works on a laptop running Vista. But since I hate Microsoft and all their shoddy work they try to force on me, I will not surrender to simply running it on Vista. So...
Serial to serial works fine on a Linux desktop machine. Problem is, my Ubuntu Linux laptop doesn't have a serial port, hence the need for the USB to serial cable. I read that the FTDI drivers needed to make USB to serial cables work can be found in the Linux file system already, without the need to locate a 3rd party driver. I don't know how to dig it out though, or even where to look. The other thing is, will it work for any USB to serial cable, or will it only be compatible with certain brands?
One other drawback which may come down the line shortly is this; Will the program I run when running under Linux, be able to take input from the keyboard?
you might also want to try this:
http://forums.parallax.com/showthread.php?p=536320
hope it helps
Adrian
So it is a driver issue. I don't use Usb, but the various USB-serial adapters do appear to be finicky about their drivers, from what I've read.
Regarding your other drawback; if you have a Stamp program that looks to its programming port (or any SERIN for that matter) for external data supplied by the PC, that data can be sent to the Stamp on the fly with a shell command such as "echo "data" > /dev/bstamp I keep an xterm session open just to do that. shell commands can be written into programs as well.
bstamp_run opens a "receive" session when it loads the Stamp program, so any messages or data sent via DEBUG will be seen, but the developer never (at least in my version) got the "send to Stamp" part working... which is why I use the separate xterm session to send data to the Stamp
I hope that I covered your concern.
Adrian,
I'll have to explore the other thread, 'cause I do have a couple of BS2px's, which I'd like to use under Linux. Thanks for the link.
Regards,
Terry
P.S. I may have sent another version of this message. I wrote it, but it seems to have disappeared int the mists.