My Tachyon Forth, new experience
Rsadeika
Posts: 3,837
in Propeller 1
I have to take a break from C, FlexBasic, FlexC, so on and so forth. I decided to give Tachyon Forth a 10th chance, or there about.
So far so good, I think I am getting a grasp on the way the stack is used and how to do arithmetic, the fourth way. I have tachyon5v7 installed, I guess that is the latest.
Before I go any further, one big question, as you make or create the new words, how do you save them? Or do they have to b e recreated every time the processor gets re-started? The other question, where is a listing of the built in Tachyon words? I guess that should do it for now.
Ray
So far so good, I think I am getting a grasp on the way the stack is used and how to do arithmetic, the fourth way. I have tachyon5v7 installed, I guess that is the latest.
Before I go any further, one big question, as you make or create the new words, how do you save them? Or do they have to b e recreated every time the processor gets re-started? The other question, where is a listing of the built in Tachyon words? I guess that should do it for now.
Ray
Comments
For all the latest documentation and howto and links etc, just go to the SourceForge site in my signature.
Here is a quick link to a link page.
Ray,
I use TerraTerm as my editor for TAQOZ. After I write and debug my definition using the editor, I copy & paste it into windows notepad as a text file and save it.
I will put collections of words used to do specific things or to build more complex definitions into the same file. For example, a group of general words/aliases that I usually use is in file "general.fth" (I am not very creative when it comes to naming things.)
Then when I want to use a specific group of words I just open the file in notepad and copy and paste to TerraTerm and it loads into TAQOZ.
The P2 version can load words saved to the SD card. I'm not experienced enough with the P1 version to know how to do that on the P1.
Tom
Something weird is going on, when I type in 'HIGH 26', the LED is not turning on. When I type in 'HIGH 27', then 26 turns on. Before using HIGH, do you have to do an OUTPUTS of the pin that you want to turn on? If that is the case how would create a WORD that does the OUTPUTS of the pin you want to use. I guess, something like 15 highpin? I am thinking some how the word gets the pin number that will need OUTPUTS. I think that I am still thinking C and trying to translate to Forth.
Ray
I am looking at the 'TACHYON Forth GLOSSARY', for example: the way you would use that is - '15 DUP', assuming you have 'a' on the stack, it would print out 'a' fifteen times.
In the Starting Forth, it shows examples that use 'REPEAT', I take it that Tachyon uses DUP instead. In a nutshell, using a Tachyon word, you always put what is going on the stack first, then the word.
Ray
Is their any special reason why Tachyon is all upper case words, you would think that upper/lower case could be used. Does that mean that you could have two words like 'spaces' and SPACES'.
Ray
If you read from left to right word by word and number by number without skipping ahead and "process" each word as it comes then you will get the sense of what the "parser" does..... almost nothing
What happens here? The value 1234 is pushed onto the stack.
PRINT (or the dot symbol) prints the number on top of the stack (and drops or pops it)
Try putting a couple of numbers on the stack.
Those two numbers are just sitting on the stack waiting to be used (not really, but they are there). So let's multiply them together and print the result.
Are you starting to get the idea? It is not trying to figure out the line of text, it just figures out each word as you type, and compiles that word as soon as you hit the space bar. By the end of the line it has already compiled all those words and is ready to run them.
btw, REPEAT is not the same as repeat in Spin. Use it in a loop that begins with BEGIN and includes a conditional WHILE.
I thought I would try the old turn an LED on wait a few seconds and then turn it off. I tried:
: onoff 26 HIGH 2000 ms 26 LOW ;
Would not get past the ms. Tried ms both in upper and lower case, did not make a difference. I am thinking put the value on the stack and then the command, in this case ms.
I am starting to think in terms of the "stack", is where everything happens.
Ray
I had to make some modification to the Spin file to have it start up in 80MHz mode. I also had it loaded to the EEPROM, for a known method of reboot.
Now it seems like Tachyon is starting to get flaky after awhile. I am not sure if it is the FLiP that is protesting, or maybe something else is occurring.
I have three different terminal programs that I can use, just in case it is a terminal problem, but it seems the same problem occurs, on all of the terminals. And by flaky I mean when I type in something like FORGET sometimes it works and then it starts show that the command does not exist.
Anybody have a lead on where I can get the binary that will run on the FLiP. I thought I downloaded the correct binary, but that did not run.
Ray
I have an LED connected on P28 so I type this: For 2 seconds the LED turned off and then back on (wired active low)
BTW, there is no need to put this in a definition (such as onoff), it will run just fine from the command line which is useful for testing etc.
For the source you can go to Tachyon/P1/V5/kernel/tachyon5v7.spin but because this is the output of a script that builds the kernel you will have to manually enable the 80MHz section but commenting out (or removing) the #ifdef and #endif for this setting.
Tachyon automatically works out if it is a 5MHz or 10MHz crystal, so there is no need to change this setting.
Ray
BTW - which Prop tool are you using to load the Propeller?
Maybe if you just force it to stay on 5MHz like this:
The last two lines are just when it decides whether to call the setpll routine which we just comment out.
The setpll routine was something that PhiPi wrote years ago and it shoudn't matter if it is an oscillator rather than a crystal either since this routine runs fine on my boards.
I did the binary first, loaded it with Propeller Tool, and nothing was happening. I noticed that the binary file size is 64K, what happens when you load it to a FLiP which is 32K?
I also made the recommended changes to the .spin file, loaded it, and was still getting the same flaky results.
I guess I have a copy of Tachyon that runs, but it does not run as expected. So, it looks like it might be time to move on, again. I was hoping to get a little bit more distance out of this run with Tachyon.
Now I have to sit back and rethink what the next step will be. Maybe I am using the wrong processor for the stuff that I am doing. At one point it is a shortage of program memory, at another point it is the lack of availability of some well documented software. Forums are great, but well written software documentation is even better. I know everything is free and open, so make do.
Ray
Have you tried loading on other software onto the Flip recently to check that it works?
ANYONE WITH A FLIP? CAN YOU PLEASE TRY LOADING THIS BINARY TO MAKE SURE IT WORKS.
Serial terminal at 115200. The binary is 64k but the loader will only ever load the first 32k anyway.
I use 'propeller-load' for programming because I haven't got a proper PROP PLUG, only an FTDI module which I've modified to output RTS to reset the P1 for programming.
My Propeller board is diy with a 5MHz crystal, with 64k eeprom on ports P28 and P29. The terminal is connected to P30 and P31. An SDcard is connected to P0 to P3. Peter's TACHYON.binary is set up for the SDcard on other pins. To get the SDcard to work I input on the terminal : &03.00.02.01 SDPINS . Then the SDcard is recognised and tachyon remembers the new pins.
1. How are you powering your board? Check the supply voltages on the FLiP are within spec.
2. How are you programming your FLiP?
3. If it does program ok and you get a boot up message, what happens when you run this simple soak test by entering on the terminal:
BEGIN WORDS KEY UNTIL
It should repeatedly output the word list to the screen until you press any key, then you should get the tachyon prompt waiting for more input from you.
Cheers, Bob G4BBY
So, what is wrong with the FLiP that I was using. This is the worst case scenario, it gets a program loaded and it runs, but it does not work as expected. I used the same USB cable for both units. The reason that I switched the FLiP modules is because the other one was running weird with a SimpleIDE C program that I created. Now I have a FLiP that runs as expected, using Tachyon, but it runs flaky with the very short SimpleIDE C test program.
Scratching my head, do I now have two flaky FLiP modules, that still run programs, in a flaky manner. I thought the FLiP was supposed to be a highly reliable unit.
Has anyone created a diagnostic program for checking out the FLiP module. What would have to be checked, the RAM or the processor itself, or something else.
I guess if the FLiP cost a dollar, I could buy them by the dozen, and just toss them as they start to work flaky.
Ray
1. Please follow my advice above
2. If you can run the Tachyon soak test for 1/2 hr or more, then the EEPROM, crystal, USB link and quite a lot of the CPU are OK.
3. Try that on both modules
4. Have you ever reliably run the SimpleIDE C test program? If not, it isn't a useful test of the hardware - and it may have a bug in it that causes a crash after some time. Try simple SPIN programs and see if they soak test OK.
5. If you are getting power from the USB port of a PC, are you sure the PC is capable of giving enough? Some USB ports have limited output. Some USB ports require a command to raise the output power. If your P1 gets starved of power momentarily that could lead to unreliability
One of the problems with the USB spec right from the beginning was this reliance on 5V power over a long cable and still expect to get 5V. It would have been a much simpler matter to supply say 12V and switch down at the load. That way the current and thereby the voltage drop would be much less, but even so, there is plenty of headroom in 12V nonetheless.
The only issue now is, when you load up the Tachyon 64K version, and it starts up, it turns on the p26 LED on the FLiP. It occurs on both FLiP modules, so it seems to be a software issue.
More test to be done.
Ray
If none of your USB cables fixed the power issue, it's more likely the computer USB power source is current limited slightly below that required by the P1. The P1 will draw more current, the more instructions per second it has to perform. Maybe your C test program drew that little bit more current than tachyon and so crashed the cpu after a random time.
Below is what I see on boot up, man that is a lot of stuff, I think. What are the implications of:
FREE: = 1366 bytes
how many words can be developed from this.
Ray
2000 us is only 2 thousandths of a second, so too quick to notice. Try 2000000 us ( 2 s ), your led switching should be slow enough to see then.
1366 bytes is (I think) the free space available for new words. Most calls to a forth word will take 2 bytes. This doesn't sound much, but you will be surprised how much forth you can write into that space.
I wouldn't be surprised if you want more space ( and you are not using an SDcard ), type FORGET EASYFILE <enter>. Check the extra space then available using the shortcut key combination <ctrl> ?
Remember that FORGET <forth word> will forget that word and all words defined after that word. Very useful when you want to start over.
This gain in space is not permanent; if you power off and on, it is lost. The new space can be permanent if you save the tachyon image to EEPROM before switching off; just type BACKUP and wait for the 'spinning' symbol to stop.
The word RESTORE loads tachyon into the P1. The word REBOOT is just like switching the P1 board on, a total restart
Tachyon is a bit of an elephant inside a P1, it does occupy a lot of space. Nevertheless, quite complicated programs are possible. With TAQOZ in the P2, you have a very large memory space available for user programs and data. I'm looking forward to experimenting with that, but after some time getting used to Tachyon.
It surprises me how little the Propeller community uses Tachyon or Taqoz. If they really got behind it, helped flesh out the missing documentation, and discovered how powerful it was..... Peter Jakacki has achieved so much with it, partly because he's very inventive and enthusiastic, but partly because forth makes for a very efficient programming language when you know it well. It all depends how much effort you are willing to put into learning the language and giving yourself enough time to play with it to find out what works. That doesn't happen overnight! I recommend reading the 'Starting Forth' and 'Thinking Forth' books in Peters' dropbox. They explain a great deal, and simply.
BTW, When I need even more memory I start with the kernel, add EXTEND, FORGET TOOLS, add EASYFILE, then RECLAIM unused private dictionary words. With that I have enough free memory to add EASYNET with FTP and HTTP servers yet still have enough memory left over for an application too.
STARTUP MESSAGES: (line number for reference)
DESCRIPTION:
My guess is that Peter just uses it to drive an LED on to show that Tachyon (and any user application ) has successfully started when there is no computer terminal connected
So I notice that three extensions to the kernel language are loaded EXTEND, TOOLS and EASYFILE.
If FORGET EXTEND is typed in, the free space for a user program jumps up to around 20 kbytes. However, the BACKUP word is lost because it was defined in EXTEND.FTH
If the EXTEND.FTH file is reloaded via the terminal, the free space is then around 7.6 kbytes. I notice that EXTEND.FTH contains a lot of non-essential extensions for driving certain chips and so on. So EXTEND.FTH can be reduced in size quite a bit to regain more user program space, remembering to keep the BACKUP facility so the system can be saved off to eeprom. A useful exercise would be to see how small an EXTEND.FTH can be made and still do BACKUP ;-)
I've been looking for the source code for the TOOLS module, but haven't found it - can anyone point me to it please? Perhaps I'm having a 'senior moment'
If you want to start over by forgetting EXTEND you should really do a COLD start, or hit ^Z^Z shortcut. This leaves the kernel ready to take EXTEND again, but normally that would be unnecessary. What you might want to do at a later stage but not while you are learning, is to FORGET TOOLS which will forget EASYFILE and many of the tools and leave 11.5k free. BUT, DON'T DO IT as there is no need to and it will only hamper you.
BTW, COLD itself does not wipe the EEPROM since that would require EXTEND. If you reset after a COLD it will fire up normally with EXTEND.