Tachyon NEON V5 (FAT32 and Ethernet Servers in 32kB EEPROM!)

1101112131416»

Comments

  • Ok Vacation is over and back to work I âm scheduled 6 days straight so I may not get to try this out for a while. Damn auto complétion is driving me nuts Right now il is trying to do everything in French!
    Jim
  • CtlAltDelCtlAltDel Posts: 37
    edited October 23 Vote Up0Vote Down
    Hi all,

    A question regarding inter-cog sharing of variables: I have written a custom ROM that continually reads an external ADC. The values that the cog reads are needed (after a certain amount of processing) by another cog. Am I correct in assuming that the way to do this is to declare a variable in the 'supervisory' cog, and then have the supervisory cog, when it loads the ROM, pass the address of the variable as a LOADCOG parameter, which the ROM cog then uses to write the data to?

    Cheers!

    Andrew
  • CtlAltDel wrote: »
    Hi all,

    A question regarding inter-cog sharing of variables: I have written a custom ROM that continually reads an external ADC. The values that the cog reads are needed (after a certain amount of processing) by another cog. Am I correct in assuming that the way to do this is to declare a variable in the 'supervisory' cog, and then have the supervisory cog, when it loads the ROM, pass the address of the variable as a LOADCOG parameter, which the ROM cog then uses to write the data to?

    Cheers!

    Andrew

    Yes, this long address is passed in 14-bits of the destination register that is used in the coginit instruction itself.
    COGINIT ( dest -- cog ) PAR(14), CODE(14), NEW(1),COG(3)
    

    When you load a ROM this ends up calling coginit so "par" is the full long address that ends up being encoded into coginit. If your code doesn't use PAR then it doesn't matter and this value can be zero.
    pub LOADCOG ( name cog par  -- )
    

    In VGA.FTH you can find an example:
    " VGA32x15  " 3 vgapars LOADCOG
    

    Then vgapars is the address of a data structure that in this case holds the setup parameters for VGA.
    TABLE vgapars PRIVATE
        0 ,                --- 0:status              ' 0/1/2 = off/visible/invisible - read-only
        1 ,                --- 1:enable              ' 0=off (disabled completely)
        16 7 + ,           --- 2:pins                ' vga pin group 0,8, or 16.
        %1000 ,            --- 3:mode                ' %tihv = tile,interlace,hpol,vpol   write-only
        vgabuf , colors ,  --- 4:screen 5:colors     ' pointers to screen (words) and colors (longs)
        32 , 15 ,          --- 6:cols 7:rows         ' horz and vert tiles (characters)
        1 , 1 ,            --- 8:hx 9:vx             ' horz and vert tile expansion
        0 , 0 ,            --- 10:ho 11:vo           ' horz and vert offset
        512 , 10 ,         --- 12:hd 13:hf           ' horz display ticks, front porch
        75 , 43 ,          --- 14:hs 15:hb           ' horz synch ticks, back porch
        480 , 11 ,         --- 16:vd 17:vf           ' vert display lines, front porch
        2 , 31 ,           --- 18:vs 19:vb           ' vert synch lines, back porch
        CLKFREQ 2 >> ,     --- 20:rate		         ' tick rate (Hz)
    
    

    So if you have a simple variable then just pass the address of that variable
    long romdata
    "MYNEWROM32" 3 romdata LOADCOG
    

    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    P2 SHORTFORM DATASHEET +++++ TAQOZ documentation
    Brisbane, Australia
  • Thanks Peter, supplementary question: if I have uploaded a ROM, then later uploaded a corrected version, both versions appear (although at different addresses). Is there a way to delete ROMs from the EEPROM (e.g. using EFILL)? I've checked the EXTEND source, nothing obvious there.
    Also, after uploading my first ROM, the VGA, UART, HSUART and F32 ROMs are now appearing in the detected ROMs list on bootup - is this a relic of a previous tachyon install?
  • CtlAltDel wrote: »
    Thanks Peter, supplementary question: if I have uploaded a ROM, then later uploaded a corrected version, both versions appear (although at different addresses). Is there a way to delete ROMs from the EEPROM (e.g. using EFILL)? I've checked the EXTEND source, nothing obvious there.
    Also, after uploading my first ROM, the VGA, UART, HSUART and F32 ROMs are now appearing in the detected ROMs list on bootup - is this a relic of a previous tachyon install?

    The old system used from $E000 onwards but the new ones are from $C000 onwards. Best to wipe that whole section with $C000 $4000 $FF EFILL. It might be possible to replace a ROM if the new ROM was the same size, but I will have to add some functionality to permit it to do that. As it is, I'm having too much fun with the P2 :)


    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    P2 SHORTFORM DATASHEET +++++ TAQOZ documentation
    Brisbane, Australia
  • Understood! Thanks again Peter :smile:
  • Sorry to bother you yet again Peter - having problems getting the ROM to write values to the hub variable. To help get to the bottom of it I have written a simple ROM that should do nothing but write $AAAAAAAA to the supplied hub address over and over:
    {{ testrom.spin }}
    
    PUB start
    { }
    
    CON
    
    DAT
    { }
    	org
    	byte ".ROM"                       ' ROM signature
    	word @testend-@testrm               ' size
    	byte "TESTRM    "                 ' name
    	'     1234567890
    
    	org
    							
    testrm
    			wrlong	val, PAR
    			jmp		#testrm
    
    val		long		$aaaaaaaa				
    testend
    			fit 496
    

    I compiled it to a binary:
    ./bstc.linux -b testrom.spin
    

    converted it to hex:
    python bh.py --binaries=0,testrom.binary
    

    and added the SAVEROM command:
    SAVEROM
    :20000000001BB70000821000380040003400440028000200240000002E524F4D0C0054457D
    :180020005354524D20202020F0053C0800007C5CAAAAAAAA3200000017
    :00000001FF
    

    Here's the resulting output:
    Propeller .:.:--TACHYON--:.:. Forth V5r4 NEON 540181011.1000                                                          
      *** MODULES ***  Propeller .:.:--TACHYON--:.:. Forth V5r4 NEON 540181011.1000                                         
    2ECA: TOOLS            DEV TOOLS                                                                                        
    1A00: EXTEND           Primary extensions to TACHYON V5 kernel  - 18104-0900                                            
                                                                                                                            
                                                                                                                            
    FREQ = 128.00MHZ                                                                                                        
    *** INITS ***                                                                                                           
    *** ROMS ***                                                                                                            
    C01C: TESTRM       12                                                                                                   
    *** I2C ***                                                                                                             
    $A0 EE/RTC                                                                                                              
    I/O =  31 :UHUU 27 :~DD~ 23 :~~~~ 19 :~~~~ 15 :~~~~ 11 :~~~D 7 :~~~~ 3 :~~~~                                            
    INTERCOM:                                                                                                               
                                                                                                                            
    CODE:$3AA0 = 14496 bytes                                                                                                
    NAME:$5E08 = 5624 bytes                                                                                                 
    DATA:$75D9 = 201 bytes                                                                                                  
    FREE:      = 9064 bytes                                                                                                 
     Data Stack (0)                                                                                                         
    Mon, 01 Jan 2001 00:00:01 UTC                                                                                           
    --------------------------------------------------------------------------------                                        
    ...  long testvar                                                                                                       
    ...  " TESTRM"  7 testvar LOADCOG -->  ok                                                                               
    ...  testvar @ .LONG --> 0000.0000 ok                                                                                   
    ...  testvar @ .LONG --> 0000.0000 ok                                                                                   
    ...  
    

    Instead of AAAA.AAAA, testvar value is 0000.0000

    Where am I going wrong?
  • It looks fine except that the name must be exactly 10 characters with the way it was done so just use
    " TESTTRM   " 7 testvar LOADCOG
    

    I suppose I could process shorter strings and also make sure we get a success/fail response.

    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    P2 SHORTFORM DATASHEET +++++ TAQOZ documentation
    Brisbane, Australia
  • Yes, that sorted it - many thanks again Peter!!
  • Does anyone use the F32 ROM?

    I need to populate an SPI flash chip (connected to the P1) with a LUT of 20-bit log values for use in another application, but I'm having difficulty figuring out what how to call the functions in the ROM. From reading the source, I gather that your application provides the address of the first of 3 consecutive longs: cmd, fnuma, fnumb. The command is stored in cmd, and the numbers stored in fnuma and fnumb. A non-zero cmd causes F32 to inject the contents of cmd as an instruction to call the desired function. I've tried generating a list file from the F32 spin source, and using the compiled call table entries as cmds, but no go.

    Can anyone shed a ray of light here?
  • Actually never mind - I generated a text file programmatically that consists of lines of the format:
    address value WRFLASH
    

    WRFLASH writes 'value' into the flash at 'address'

    I can then 'select all' and paste a la EXTEND...much more sensible :smile:
  • Peter JakackiPeter Jakacki Posts: 7,804
    edited October 24 Vote Up0Vote Down
    CtlAltDel wrote: »
    Does anyone use the F32 ROM?

    I need to populate an SPI flash chip (connected to the P1) with a LUT of 20-bit log values for use in another application, but I'm having difficulty figuring out what how to call the functions in the ROM. From reading the source, I gather that your application provides the address of the first of 3 consecutive longs: cmd, fnuma, fnumb. The command is stored in cmd, and the numbers stored in fnuma and fnumb. A non-zero cmd causes F32 to inject the contents of cmd as an instruction to call the desired function. I've tried generating a list file from the F32 spin source, and using the compiled call table entries as cmds, but no go.

    Can anyone shed a ray of light here?

    I have the F32 ROM in there for anyone who wants to use FP but I don't use it myself and so I have never written any of the interface and conversion functions for it although you could probably look at the Spin source if you wanted to give it a go :)

    There is some basic test code I used to make sure it was working fine. When I find it later on I will post it.


    Tachyon Forth - compact, fast, forthwright and interactive
    useforthlogo-s.png
    --->CLICK THE LOGO for more links<---
    Latest binary V5.4 includes EASYFILE +++++ Tachyon Forth News Blog
    P2 SHORTFORM DATASHEET +++++ TAQOZ documentation
    Brisbane, Australia
  • Hi Peter,

    Yep I read the source (I mentioned in my previous comment I generated a list file to try and figure out the command mapping) but meh, my text file is a much easier way to solve the problem. I need the external LUT as I'm doing some fast integer PI control, and have to linearise the input quantity, which has an exponential relationship with the control output.

    I'd be curious to see your example source, though.
  • Peter,
    Did you ever create the code to use the counters to measure incoming PWM signals?
    Jim
Sign In or Register to comment.