Shop OBEX P1 Docs P2 Docs Learn Events
TACHYON O/S V3.0 JUNO - Furiously Fast Forth, FAT32+LAN+VGA+RS485+OBEX ROMS+FP+LMM+++ - Page 4 — Parallax Forums

TACHYON O/S V3.0 JUNO - Furiously Fast Forth, FAT32+LAN+VGA+RS485+OBEX ROMS+FP+LMM+++

12467109

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2012-08-04 19:19
    { HS-SerialRx - High speed Serial Receive }

    While cog space isn't an issue right now I'd still like to mention things I'd have done differently (have to make up for the 2 insns inserted on my behalf).

    DAT variables can be accessed the same way as VARs (if nothing else it's easier to read IMO).
    [COLOR="silver"]long[@[/COLOR]rxpin[COLOR="silver"]][/COLOR] := |<rxdpin
     [COLOR="silver"]long[@[/COLOR]bitticks[COLOR="silver"]][/COLOR] := (clkfreq / baudrate)
    
    PASM:
    mov     Y0,rxbuf
    sub     Y0,#4
    mov     X0,#0
    wrlong  X0,Y0
    
    With rxbuf being @HSSerialRx+4 this effectively clears long[@HSSerialRx]. That said, rxwr is initialised to @HSSerialRx+3 which means we can get away with:
    wrlong  par, rxwr         ' wrlong ignores rxwr[1..0] which means we write to @HSSerialRx
    
    Image padding to fixed size (65 longs or 256+4 bytes). This disables itself in case the image is big enough on its own.
    breakcnt                long    40
    
    [COLOR="orange"]padding                 long    -1[(65 - $)&($ < 65)][/COLOR]
    
    rxcnt                   res     1
    
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-04 19:40
    msrobots wrote: »
    @Peter,

    yes I am one of those programmers trained to think the other way. The whole concept of a DataStack still confuses me. So definition of PRTHEX for example. I think I do understand how it works and why. So far so good.PRTBYTE..WORD..LONG ok also. Then I hit DUMP.
    <snip>

    PRTHEX or .HEX as it is referred to in the dictionary is probably one of the first definitions I coded in bytecode to help me debug in the early stages. It's job is very simple as part of the "hex print" family it didn't have to worry about number bases. Passing parameters on a stack is normally hidden from a programmer and many languages will use a frame stack internally or something similar. Forth doesn't try to hide how things work unless you want it to but even then you can always dig right into the very inner workings of it easily. But take care when viewing the document as it's also an experiment in progress! I noticed on the first line of PRTHEX that I said "_BYTE,$0F" which is equivalent to saying "MOV tos,#$0F" but pushing the stack before hand which is why the original name is also used on the next line. Here I say "PUSH1,$30" which is equivalent to "MOV tos,#$30" etc. I haven;t decided yet as to which way is the most sensible.

    Remember too that part of the problem here was also representing bytecode clearly in the Spin tool and working with it's syntax. If this had been a macro-assembler I could have made the code far more readable because you see that the branches get messy with their "_IF,@PRTCH-@PH1" calculations. I tried to balance the readability (and "writability") with runtime operation which is one of the reasons I dropped the /2 after each bytecode by limiting the calls to the first 256 longs without any compromises in reality. The other thing that made it a lot more readable/writable is making the jumps and calls relative so that the +$10 can be omitted and having an XCALL method made it both more readable and efficient at the same time as XCALL,xEMIT would otherwise be written as "RCALL,@PRTBYTE-@EMIT" assuming that EMIT was in range of a single 8-bit relative address.
    [B][COLOR=#000000][FONT=Ubuntu Mono]' .HEX ( n -- ) print nibble n as a hex character[/FONT][/COLOR]
    [COLOR=#FF0000][FONT=Ubuntu Mono][B]PRTHEX[/B][/FONT][/COLOR][COLOR=#000000][FONT=Ubuntu Mono]  ' ( n -- ) print n (0..$0F) as a hex character[/FONT][/COLOR]
    [COLOR=#000000][FONT=Ubuntu Mono]     byte    _BYTE,$0F,_AND[/FONT][/COLOR]
    [COLOR=#000000][FONT=Ubuntu Mono]     byte    PUSH1,$30,PLUS[/FONT][/COLOR]
    [COLOR=#000000][FONT=Ubuntu Mono]     byte    DUP,PUSH1,$39,GT,_IF,@PRTCH-@PH1[/FONT][/COLOR]
    [COLOR=#000000][FONT=Ubuntu Mono]PH1    byte    _7,PLUS                      'Adjust for A..F[/FONT][/COLOR]
    [COLOR=#000000][FONT=Ubuntu Mono]PRTCH    byte    XCALL,xEMIT,EXIT[/FONT][/COLOR]
    
    [COLOR=#000000][FONT=Ubuntu Mono] ' .BYTE ( n -- ) print n as 2 hex characters[/FONT][/COLOR]
    [COLOR=#FF0000][FONT=Ubuntu Mono][B]PRTBYTE[/B][/FONT][/COLOR][COLOR=#000000][FONT=Ubuntu Mono]     byte    DUP,_4,_SHR[/FONT][/COLOR]
    [COLOR=#000000][FONT=Ubuntu Mono]     byte    XCALL,xPRTHEX,XCALL,xPRTHEX,EXIT[/FONT][/COLOR]
    [/B]
    
    BTW, from the Tachyon terminal this definition could be defined this way:
    : .HEX  ( n -- )  $0F AND $30 + DUP "9" > IF 7 + THEN EMIT ;
    : .BYTE ( n -- ) DUP 4 SHR .HEX .HEX ;
    
    In PASM (no stack, assumes "tos" is the register):
    PRTHEX                
              and  tos,#$0F
              add  tos,#$30
              cmp tos,#39 wc
    If_c      add  tos,#7
              call  #emit
    prthex_ret
    
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-04 19:50
    kuroneko wrote: »
    { HS-SerialRx - High speed Serial Receive }

    While cog space isn't an issue right now I'd still like to mention things I'd have done differently (have to make up for the 2 insns inserted on my behalf).

    DAT variables can be accessed the same way as VARs (if nothing else it's easier to read IMO).
    <snip>

    Thanks for the help Kuroneko, I know the code looks like a bit of a hack but it was just to get some terminal input at the time so I could get Tachyon communicating! :) I appreciate too the explanations because I just play with Spin and PASM and I do forget and get confused at times because I work with other architectures. Writing Tachyon is helping me to get back up-to-speed with PASM though.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-04 21:01
    D.P wrote: »
    Sorry about the last terse message.
    Okay just a little confused. I understand and have been using IIC.fth and others. Performing a RESET maintains my "user code" if I have done a BACKUP. Power off and on removes my "user code" and I get: Cold start - no user code - setting defaults. Got it. _My problem was trying to AUTORUN a word that used EMIT and I didn't get any output so I thought (mistake) it was the kernel. PEBKAC! Can / will we be able to disable "cold start" after power failure to enable AUTORUN the "system". NOCOLD

    I setup a complicated AUTORUN routine and ran BACKUP and then powered off completely. Plugging it back in it ran through all it's hoops just like a charm. Now coming back to that PEBKAC..........
    Hint! When you load your code in from a cold start and before you have done anything else just make sure that the definition you want as an AUTORUN will work on it's own. So type it in, put on a strong face and press <enter>......What happened? Did it do everything as it should? If you are still having problems then please just post the code so you can have another eye glance over it.
  • msrobotsmsrobots Posts: 3,701
    edited 2012-08-04 22:27
    @Peter,

    thank you. I do know that looking at the ByteCodes is less easy than looking at FORTH but for me it is more easy to look at the PASM behind then. So working my way up from PASM to ByteCode I try to grook the whole thing. By now I really like the code. Seems to me that this kernel should be quite fast.

    I usually build my stuff on a PPDB (and this is full now) then move over to ProtoBoards and wire it together. So I am still looking for that DemoBoard thing I got myself a while ago... this has also VGA... and it is here, somewhere ... if the dogs don't found it inbetween. Two days ago they found my wallet... they had FUN. An my money and cards where everywhere around in the house...

    So Tachyon is not running yet here but will soon do so. Until then I read your source...

    and ENJOY! it

    Mike
  • D.PD.P Posts: 790
    edited 2012-08-05 09:28
    Just trying to keep up with you all: Forth V1.0 rev120806.0000, you moved "free" to "FREE", "IICBUS" to "I2CBUS"..... Everything works for me as expected, COLD, AUTORUN, BACKUP. Nice to have Extend.fth and IIC.fth in one file now.
  • PowersoftPowersoft Posts: 72
    edited 2012-08-05 11:47
    Hello,

    Today I try to load the TACHYON byte forth.
    When I try to compile the "HS-SerialRx" I get the error no PUB routines found.
    Please can you take a look?
    I download the latest files.


    Thanks in advance,

    Jan Kromhout
    Hellevoetsluis-NL
  • D.PD.P Posts: 790
    edited 2012-08-05 11:58
    @Powersoft

    You need to have the HS-SerialRx.spin file in the same directory as the Tachyon1v0-VGA.spin file, or in the library path for the compiler you are using: BST (linux, mac) or PropTool on windows.
    Introduction and link to all the files at the bottom of this page courtesy of Peter.
    https://docs.google.com/document/pub?id=1bEH0DfGmu99M1SqCbmlzl991Ssv2J5m6XWmkJX0XSl8
  • D.PD.P Posts: 790
    edited 2012-08-05 12:54
    Should have read your post completely!

    Looks like some misplaced comments. Attached are the three files I am currently using to compile and EXTEND the kernel. Make sure you set the baud rate and PLL to your needs in the Tachyon spin file.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-05 16:02
    msrobots wrote: »
    @Peter,
    So Tachyon is not running yet here but will soon do so. Until then I read your source...
    Mike

    WHAT! Why aren't you running it on any board yet? I have a variety of boards, many without VGA and I just load it on and it goes. The only side effect of having VGA enabled is that P16..23 will be set to output VGA data. If that's a problem then just disable VGA either in the Spin "start" statement or stop the cog. In fact I will upload a few different binaries just so they don't have to be compiled. Just check the bottom of the intro page for the links.
  • msrobotsmsrobots Posts: 3,701
    edited 2012-08-05 17:17
    @Peter,

    yes - sadly. But I am specially interested in that VGA-Display since I found out that using VGA and graphics.spin does not leave you enough room to do much in spin. Especially if I try to use KYEs Fat-Engine too.

    So I haven't had anything to USE that little (expensive) Demo-Board. But I think Tachyon may be a nice fit there. I just need to find it....

    I started putting autodoc comments into your code. I used the 'paint' thing to color them like you colored the curly brackets so they are quite invisible. Doing that I stumbled about those two lines (hr?) above the yellow block (internal cog routines). Copying the source into Proptool results in two lines of minus-signs in the prop-source. I was not able to put comment char (') in front of them. Somehow I can not really position the cursor in Google-Docs. If i write something it appears about 10 characters left of the cursor. Maybe Google-docs do not like IE and wants CHROME or so. Copy and Paste works but typing is a PITA and writes usually somewhere else in the line not where the cursor is.

    Enjoy!

    Mike
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-05 18:14
    WHAT! Why are you using IE? :) That is totally weird, I have been trying with all kinds of browser but I never use IE so I jumped on a Windows 7 machine, went to the forum, click on my thread, then on the link to the Tachyon Intro and it wants me to sign in which I never have to do on any other browser. What's going on? So I switch to a guest account on the same machine....and it works fine...good, I was worried there. But try Chrome or Firefox at least, they are only a click away. I get the same problem with Chrome if I try to zoom out but it also gives me a warning that the zoom mode is not supported in Google Docs for editing.

    BTW, the tick symbol above the TAB key is not always the right one for the Spin compiler. I have edited the source in Firefox and it puts in a tick that is wrong. If I ask Tachyon what it is seeing it reports instead of the ASCII character for $27 the tick from Firefox using Google Docs is the sequence E2 80 98.

    +BTW, I'm working on my SD access routines at present which just allows access to the SD as if it were a huge virtual memory using SD@ and SD! words etc after which I will build a FAT16/32 layer on top of that. I will probably allow for several 512 byte sectors to be cached to RAM a bit like the original disk blocks that Forth used to use. Since I have control over how files are created and written I always enforce a non-fragmented file write as this allows direct access to the file as virtual random access memory. Just open the file which returns with it's handle and "memory" address.
  • msrobotsmsrobots Posts: 3,701
    edited 2012-08-05 20:29
    Jupp,

    that tick-thing is stupid too, but easy to handle ... just mark and copy existing one in the doc and paste, that works.

    Yes i do use IE and all of that windows-stuff. From SQL 2008R2 to Visual-Studio, AD with all the goodies like system-policys and roaming-desktop, one-click install, you name it. Doing this for years in differnt environments from small to big.

    The only thing I really skip there is MS-Exchange. This beast is not for me. I use LumiSoft-mailserver wherever needed.

    Outside of the geeky groups - in opposite to alot of belives - windows IS quite common in ALL companys I ever worked for. In Germany alike as in California. Sorry but I tryed and failed... I never again will run a serious Database on MySQL,never,never again. Not after having the quality of tools in MS-SQL or Oracle. If I do need Unix-things, well there is SUN. Partitioning like in MainFrames and very scalable. But to expensive for me. Still running two old ones in Germany but they are allmost out of work now and will be replaced by w2008 too.

    Since I entirely work over RemoteDesktops form Home I do have just the absolute minimum of things installed on my local machines, so it boils down to the PropTool, PropGCC and CodeSourcery for ARMs. Somewhere Office 2010. No local files if possible.

    When I spill my beer over the Walmart-Laptop - well **** happens - I get another one for $200-300 upgrade windows, log into my network and DONE. Back to work, nothing missing.

    I do have a debian-linux for testing compability with MONO - yet in the last 14 years none of my customers asked for. See above. All are using Windows on there Desktops. Most of them on the server side also. But this are companys and they just buy what they need, including licences.

    At Home things might be different and more people are using linux, MySQL, etc, not willing to spend money for SQL2008 Enterprise or such. Sure. But they don't need a DB like that then anyways, or?

    (hiding behind ice-block to avoid upcoming heat)


    Enjoy!

    Mike
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-06 02:20
    The Introduction page has been updated with a section on BACKUP and AUTORUN as well as a link to a YouTube video showing the whole compile from on-line source, to loading in Forth source and demonstrating an AUTORUN with an SPI 128x64 Graphic LCD and I2C bus LEDs.
  • PowersoftPowersoft Posts: 72
    edited 2012-08-06 07:02
    Hello,

    I download a TACHYON version (binary).
    As terminal I use Tera Term.
    All is working well.
    But now I try to load the extended.fth file with the command "send file"
    But I get on;y errors.
    Is there another way to download these file?

    Thanks for any help.
    Cheers,

    Jan Kromhout
    Hellevoetsluis-NL
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-06 07:14
    Hi Jan,
    Make sure you have set a line delay of around 30ms. Can you copy&paste from your terminal to here so I can see what's happened?
  • PowersoftPowersoft Posts: 72
    edited 2012-08-06 08:01
    Hi Peter,

    Thanks for the reply. After setting the line delay to 30 ms I could load the file.
    Can now start to play with it!!

    Cheers,

    Jan
  • D.PD.P Posts: 790
    edited 2012-08-06 09:37
    The Introduction page has been updated with a section on BACKUP and AUTORUN as well as a link to a YouTube video showing the whole compile from on-line source, to loading in Forth source and demonstrating an AUTORUN with an SPI 128x64 Graphic LCD and I2C bus LEDs.

    Hey Peter, nice additons to the doc. I'm currently running minicom 2.6.1 on Mac OSX (I'm a sucker for nice laptops, meh on OSX) and can only attach at 230_400 fyi BUT my question is the ^ keys don't seem to work as documented. I'm wondering if you have done any special configs to your minicom setup? Also looking forward to SD@ SD! and the filesystem, very cool.
  • Brian RileyBrian Riley Posts: 626
    edited 2012-08-06 14:34
    I wired up a second AT24C1024B to my PPDB and Tachyon 120806.00 read it as i suspected it would, as 4 64K devices ..see thread http://forums.parallax.com/showthread.php?141653-Getting-More-From-Your-EEPROM-Slot&p=1116016#post1116016
  • Brian RileyBrian Riley Posts: 626
    edited 2012-08-06 14:44
    D.P wrote: »
    Hey Peter, nice additons to the doc. I'm currently running minicom 2.6.1 on Mac OSX (I'm a sucker for nice laptops, meh on OSX) and can only attach at 230_400 fyi BUT my question is the ^ keys don't seem to work as documented. I'm wondering if you have done any special configs to your minicom setup? Also looking forward to SD@ SD! and the filesystem, very cool.

    IF Minicom only gives you 230,400 you might as well use Zterm. The Control keys work there just fine.
  • D.PD.P Posts: 790
    edited 2012-08-06 15:15
    Good point Brian. Back to Zterm. I tried every "valid" baud rate between 230_400 and 3_000_000 on Minicom 2.6.1. -> PropBOE. No joy except at 230_400. OSX 10.6.8 first generation Macbook Pro.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-06 15:24
    Minicom may allow you to select a baud rate regardless of the capabilities of the serial port. For instance I can select 3.5M baud and 4M baud in Minicom yet the FT232R chip "only" goes up to 3M baud. So check your serial port or use an FT232R or similar. I've always been a TeraTerm fan but even though it's open source now it's strictly a Windows program. After TeraTerm I'm not impressed with any other terminal program. But I rediscovered Minicom which I had dismissed so many times before, however it handled the rfcomm channels for Bluetooth and since then I have gotten to really like it, it certainly performs.
  • PowersoftPowersoft Posts: 72
    edited 2012-08-06 23:35
    Hello Peter,

    I wont to use the TACHYON with the ASC board to use my Arduino shields.
    On the ASC shield the I2C connection is don by P14 and P15.
    Is it posible to redirect the I2C routines of TACHYON to these pins?

    Cheers,

    Jan Kromhout
    Hellevoetsluis-NL
  • PowersoftPowersoft Posts: 72
    edited 2012-08-06 23:40
    Peter,

    I whas I think to quick with my latest replay.
    Are these the addresses of the I2C?

    : SCL 28d MASK ;
    : SDA 29d MASK ;
    : SDA? 29d INPUT ;

    And are these for my case:

    : SCL 14d MASK;
    : SDA 15d MASK ;
    : SDA? 15d MASK ;


    Cheer.

    Jan Kromhout
    Hellevoetsluis-NL
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-07 01:22
    Yes, but you might be better off leaving the existing code in place for the EEPROM and just adding the first part of the I2C code. Also you could rename the functions to SCL2 SDA2 SDA2? and I2CST2 I2CSP2 I2C2@ I2C2! or something like that, it's up to you. That way you can still access the EEPROM and any other device you might put on the EEPROM lines. However if the EEPROM is the only thing on P28,29 then it doesn't matter if you just load the definitions with the same name (except the change to the port numbers).
    I might look at updating the code to allow redirection to other pins.


    EDIT: I have just updated EXTEND.fth to allow for redirection. The word I2CPINS takes two parameters for the pin numbers and EEPROM is the word that sets up the Prop's I2C lines. BACKUP will always invoke EEPROM to set up the correct lines but otherwise you can change the pins and all the other words will follow.
  • PowersoftPowersoft Posts: 72
    edited 2012-08-07 01:49
    Thanks for the changes!
    It is working great now.
    I have added at top of the ASC board a Gravitech 7-SEG shield, wich included three I2C divices.
    With the command 14 15 I2CPINS and I2CBUS is can see now all tree addresses.

    Now I will try to get acces to all the devices.

    Cheers,

    Jan
  • PowersoftPowersoft Posts: 72
    edited 2012-08-07 02:22
    Hello,

    I found sommething to think about.
    When I try to print a binairy like

    HEX 00A0 2 base ! .

    the system seems to hang.
    Or do I sommething wrong?

    Cheers,

    Jan Kromhout
    Hellevoetsluis-NL
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-08-07 02:35
    If we had tons of memory to spare we would make base a long but it's not. Try base C! instead.
    Remember that HEX will not take effect until after the line has been executed but it is temporarily compiled first so this may not have the desired effect. You can also type $A0 2 B. which accepts A0 as hex regardless of base and also formats the number print for binary (2 B.)
  • PowersoftPowersoft Posts: 72
    edited 2012-08-07 03:16
    Thanks again.

    I have some trouble with the I2C commands name.
    Please can you help me with this small example.

    My device address is $70

    In plain text my problem is:

    Init the I2C

    BeginTransmission($70)
    Send_I2C($00)
    Send_I2C($47)
    EndTransmission

    BeginTransmission($70)
    Send_I2C($01)
    Send_I2C($3B)
    EndTransmission

    Thanks for the help.
    Cheers,
    Jan
  • PowersoftPowersoft Posts: 72
    edited 2012-08-07 04:04
    Peter,

    I found sommething strange.

    Why can't I create a variable like "CREATE DUMMY 99 ,"?
    But when I use "CREATE DUMMY 99 C," seems to work, but when I recall DUMMY I het a data stack dump

    What I wont is to create an lookup table like

    CREATE DISPLAY $3F C, $06 C, $6D C, ............

    Please can you help me with this?

    Cheers,

    Jan
Sign In or Register to comment.