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

1161718192022»

Comments

  • I've updated EXTEND.FTH with *SCL and *SDA using $7E and $7F REG addresses. This places them at the end of the 128 bytes so you only have to worry about allocating 128 bytes for each instance of a Tachyon cog.
    However there seems to be a problem and while I like to fix it tonight, I'm just really bushed and I will have to try again in the morning since I am obviously making mistakes here.
  • Thanks Peter ... I will read up on REG accesses.
    Cheers!
  • Hi Paul, I've updated EXTEND.FTH and I will get around to updating the binary as well shortly.
    Just specify I2CPINS at the start of your cog's task and you can also specify the speed if necessary.

    Remember that you can paste or send Forth code into the terminal with only 3ms line delay. No need to go slow.
  • Looks exactly like I was hoping, thank you!

    What about i2cflg? Should it be in the task register block as well ? $7D ?
  • This is how I tweaked for i2cflg. All other routines unchanged
    ---			*** I2C DRIVER ***
    
    pub *SCL			$7E REG C@ ;	--- returns the SCL pin number
    pub *SDA			$7F REG C@ ;	--- returns the SDA pin number
    
    pub *i2cflg			$7D REG C@ ;	--- returns the i2cflg to see if bus is busy=TRUE, inactive=FALSE.    --- *****************************************************
    pub i2cflg!			$7D REG C! ;	--- write the i2cflg state                                                                   --- *****************************************************
    
    pub I2CPINS ( sda scl -- )	$7E REG C! $7F REG C! ;
    
    --- byte i2cflg                                        --- *****************************************************
    
    --- wait but timeout while busy
    --- pub ?I2C	i2cflg C@ IF 1500 BEGIN 1- i2cflg C@ 0= OVER 0= OR UNTIL DROP i2cflg C~  THEN ; --- *****************************************************
    pub ?I2C	*i2cflg IF 1500 BEGIN 1- *i2cflg 0= OVER 0= OR UNTIL DROP FALSE i2cflg! THEN ;
    
    
    pub <I2C
    	?I2C
    pub <I2C>	--- restart without checking busy
    	*SDA FLOAT *SCL HIGH
    	--- setup mask for CLOCK instruction
     	*SCL MASK @SCL COG!
    ---	*SDA LOW 1 i2cflg C! *SCL LOW --- *****************************************************
    	*SDA LOW TRUE i2cflg! *SCL LOW
    	;
    
    
    { I2C STOP CONDITION also releases I2C lines
     SCL XX-------:=
     SDA XX___----:=
    }
    pub I2C>
    	--- pull SDA high from low while clock high
    	*SDA LOW *SCL HIGH ( 1 DROP ) *SDA HIGH
    	--- free up I2C lines
     	*SDA FLOAT *SCL FLOAT
    --- 	i2cflg C~						--- i2c bus free --- *****************************************************
    	FALSE i2cflg!
    	;
    
  • Yes, that's the idea. I noticed that the previous I2C routines had a bug in assigning new pins. Sure enough, you could assign new pins but @SDA was a fixed constant, so it would have failed. This was done at the time to make it faster but a MASK operation does not push or pop the stack so it is very fast and so it is just as good to say *SDA MASK than it was to say "@SDA".
    I checked the register usage and those last few bytes from $7A in the first 128 bytes are free.
    snippet from the listing.
    0038(0076)             | padwr           res 1           ' write index (builds characters down from lsb to msb in MODULO style)
    0038(0077)             |                 res 1
    0038(0078)             | undef           res 2           ' undefined word exception vector
    0038(007A) 00          |               byte  0[$200-$38]
    0200(00EC)             |               org
    0200(0000) 00 00       |         word      0
    
  • Peter,
    I just downloaded the latest binaries from sourceforge. I went to install them and discovered that the QS board where I was going to install was defective, not your problem. The question I have is how do I download a .Spin driver that runs in another cog? I want to try avsa's NRF24L01 driver and communicate between two QS props with it. The second question I have is how do I get permissions to log onto the tychon forum on Sourceforge? I was going to pose this question on the forum there but was blocked.
    Jim
  • Hi Jim, Look at the top of the page over to the right for "Create" to create an account at Sourceforge. You can go to the discussion link and create a new topic then and post. In the process of checking my settings I have also created a Tachyon for P1 and a TAQOZ for P2 forum as well.

    I will look at that Spin driver because if it is mostly PASM we can compile it as a hex file that we can load into upper EEPROM anytime as a "ROM". Then at runtime you can load a ROM by name into a cog. You would also have some minimal application "hooks" at the Forth level to interface to this cog.

    However, I have written some nRF24L01 stuff in Tachyon, mainly for sniffing wireless keyboards. So I guess I could look at that chip and see if I can come up with something useful, for you and me, for Tachyon, and for TAQOZ!
  • RS_JimRS_Jim Posts: 1,362
    edited 2020-05-24 - 13:57:05
    Peter,
    That is great! The actual driver is spin and I am sure the hooks would be easy in tachyon.
    A direct tachyon driver would also be super. Maybe it would be easier to just do in Tachyon.
    Thanks.
    Jim
    edit changed pasm to spin
Sign In or Register to comment.