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
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?
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
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?
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
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 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.
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.
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.
Little help please.
I have a +P8 IOT5500 set.
I try to learn Tachyon.
I use the recipe:
Build sequence for an IoT5500 is:
* Kernel
* EXTEND
* P8 in more/hardware headers/
* EASYFILE (combined SDCARD + EASYFILE)
* COMPACT
* BACKUP
* EASYNET (combined W5500 + EASYNET)
I start install NEON, with BST and 5r4.spin. loading , working minimal.
I can load EASYFILE with serial com, it is working.
Then I try to install the last (more/hardware headers/) P8.FHT file from dropbox, but this give errors.
@Ltech - I've zipped all the V5.4 files plus a few extra that you should be using. I notice that one file you used reported "TACHYON [~" so straightaway I knew you must be using some older V3 file. The newer files also fully support dynamic pin allocation so there is no need for a P8 file but you can make sure it is setup correctly with this:
When you do a BACKUP those settings will be locked in unless overridden.
After you load the Prop with Tachyon5r4.spin you should load EXTEND, then EASYFILE then RECLAIM private headers, then load EASYNET and optionally RECLAIM private headers. Paste in the SDPINS and WIZPIN configuration and BACKUP. I will test this out myself just to make sure.
I'll pm you shortly with some updates and other info too.
@Ltech - The trick was to do a FORGET TOOLS after loading EXTEND since these were extras that aren't needed. After loading EASYFILE you can RECLAIM and then load EASYNET. If you want FTP you can load that too although it seems that FTP.FTH needs these two lines added at the start:
1 := FTP
2 := FTPDAT
End of source code, 0000 errors found Load time = 9.0
Code bytes used = 1292
Name bytes used = 240
CODE:$4EB2 = 19634 bytes
NAME:$5604 = 7676 bytes
DATA:$78EA = 986 bytes
FREE: = 1874 bytes
Data Stack (0)
ok
...
...
... BACKUP --> BACKUP ok
...
Propeller .:.:--TACHYON--:.:. Forth V5r4 NEON 540181011.1000
CODE:$4EB2 = 19634 bytes
NAME:$5604 = 7676 bytes
DATA:$78EA = 986 bytes
FREE: = 1874 bytes
Data Stack (0)
CARD: SL08G SD03.80 #D20D.AA60 2016/2 !C0FF.80AF 1,527us
FAT: #CB4A.74CF mkfs.fat IOT5500 FAT32 7,947,157,504 bytes (4kB clusters)
Setting default IP configuration
*** Tachyon Forth EASYNET Network Servers and EASYFILE File Server ***
NETWORK STATUS:
LINK DOWN
HARDWARE: WIZnet W5500 V4
SRC IP &192.160.0.33
MASK &255.255.255.0
GATEWAY &192.160.0.1
MAC 02.FF.65.00.51.20.
SKT HH:MM:SS MODE PORT DEST TXRD TXWR RXRD RXWR RXSZ IR STATUS IP ADDR
#1 00:00:02 TCP 18516 18516 0000.0000.0000.0000.0000. 00 14 14 &0.0.0.0
#3 00:00:02 TCP 25185 18516 0000.0000.0000.0000.0000. 00 14 14 &0.0.0.0
* Servers running *
--------------------------------------------------------------------------------
*** Tachyon Forth EASYNET Network Servers and EASYFILE File Server ***
NETWORK STATUS:
LINK DOWN
HARDWARE: WIZnet W5500 V4
SRC IP &192.168.0.99
MASK &255.255.255.0
GATEWAY &192.168.0.1
MAC 02.FF.BD.5B.CE.06.
SKT HH:MM:SS MODE PORT DEST TXRD TXWR RXRD RXWR RXSZ IR STATUS IP ADDR
#3 00:00:01 TCP 71 55296 0000.0000.0000.0000.0000. 00 14 14 &0.0.0.0
If you look in the V5 Dropbox folder you will find all the current files including FTP.FTH which has this already added to the start:
TACHYON V5
1 := FTP
2 := FTPDAT
pri .IPD 4 FOR DUP 24 >> PRINT 8<< DUP IF ',' EMIT THEN NEXT DROP ;
BTW, your SD looks a little strange since it is reporting a sector read speed + latency of almost 10ms plus it sounds like it is not formatted. Just try MOUNT again and then list the directory as maybe this card is really slow and we may need to adjust some timeouts to compensate.
Now I have tried from your zip file, and it will still not succeed in making a SAVEROM.
I can see that some words are removed, including GET8 and roms, and maybe more that are used in SAVEROM.
When I use the binary file, SAVEROM works well.
In the one that doesn't works: 1A00: EXTEND Primary extensions to TACHYON V5 kernel - 18104-0900
In the one that works: 1980: EXTEND Primary extensions to TACHYON V5 kernel - 180814-1145
Is it possible to get a copy of the EXTEND.FTH that works?
when I look @ the terminal the port numbers are strange.
I set " 1 SOCKET 21 PORT!" but get PORT 32292 on the terminal ?
I can't reach the Wiz using FTP.
... 1 SOCKET 21 PORT! --> ok
... id --> ok
... ifup -->
*** Tachyon Forth EASYNET Network Servers and EASYFILE File Server ***
NETWORK STATUS:
LINK *UP*
HARDWARE: WIZnet W5500 V4
SRC IP &192.168.0.99
MASK &255.255.255.0
GATEWAY &192.168.0.1
MAC 02.FF.70.1A.C5.10.
SKT HH:MM:SS MODE PORT DEST TXRD TXWR RXRD RXWR RXSZ IR STATUS IP ADDR
#1 00:04:24 TCP 32292 18516 0000.0000.0000.0000.0000. 00 14 14 &0.0.0.0
#3 00:04:24 TCP 71 18516 0000.0000.0000.0000.0000. 00 14 14 &0.0.0.0
I can't check it right now but I'm assuming you have FTP.FTH loaded after EASYNET.FTH and this hooks in automatically for initialization and polling.
In !FTP the default port is not set, leaving user settings intact. Maybe just try that whole line without the comment for the moment just to make sure something else isn't screwy.
@Ltech - I will check this shortly but FTP and HTTP modules are added onto EASYNET afterwards but it may seem that there is not enough memory for that even after a RECLAIM. This is because EXTEND has a section called TOOLS that is not normally needed in an EASYNET environment. So after loading EXTEND you should FORGET TOOLS before proceeding to add EASYFILE and EASYNET and then FTP and HTTP. As I said I will check all this but you might also need to do an individual RECLAIM after EASYNET and FTP and HTTP since memory is pretty much used up by then. There might be some optimization I can do so I will see if this is possible when I check it.
Hi Peter,
When I load the sensors file it works fine. The problem is the second file it gets overridden by the display file and stop working.
Thanks Ken
word mm --- current ping distance in mm
word 'c --- current DHT22 temperature in Celcius *10
word rh --- current DHT22 relative humidity *10
--- Task for PING, TEMPERATURE and HUMIDITY ---
--- run this on 3 T R ping mm save H&T save save wait
128 bytes regs
pri SENSORS 3 RUN: regs 8 COG! BEGIN 12 13 DISTANCE mm W! 1 DHT 'c W! rh W! 60 ms AGAIN ; --- 60 ms loop reading variables
--- Add SENSORS as an init at boot
' SENSORS +INIT
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TACHYON V5
{ Send DATA to Seetron oLED Display from the DHT22 sensor }
4 COGSTOP \ To run in cog 3 (default)... CLOCK
FORGET OledDisplay
module OledDisplay PRINT" oLED CLOCK & WEATHER " ;
pub C->F ( n -- n ) --- Celsius to Fahrenheit
90 50 */ 320 + ;
\ CREATE A DEVICE FOR THE SERIAL LCD ON P0 (use SEROUT instead for normal logic level)
\ Display the temperature and humidity
pub SERLCD 9600 SERBAUD EMIT: 0 SEROUT ;
128 bytes clkregs \ each cog needs own registers
pub OledDisplay ( -- )
\ main clock run in cog 3
4 RUN: clkregs 8 COG!
\ display on clear display
SERLCD $0C EMIT
BEGIN
$01 EMIT \ Home
1 SPACES
\ 1 DHT C->F .AS" #~#.#'F " .AS" #~#.#%RH "
rh W@ 'c W@ C->F .AS" #~#.#'F " .AS" #~#.#%RH " \ DHT22 Data-- rh is humidity 'c is temperature( ACCESS VARS FROM ANY WHERE IN PROGRAM )
AGAIN ;
' OledDisplay +INIT \ don't forget the ' or it will not work
END
BACKUP
REBOOT
It looks like the code is out of order and you are FORGETing OledDisplay when there are two words with the exact same name, the module header, and the main clock. Try moving this to the start while renaming the module.
Hi Peter,
The below code is running on two Propeller Chips, one as a tx and one as rx. The data that is transmitted is different on the receive side. tx-> 123
rx ->249
tx ->255
rx->255 (this works)
Thanks again Ken..
{ First Propeller Chip with 915 MHZ transmitter }
word hot
123 hot W!
pub TS 9600 SERBAUD BEGIN hot W@ DUP CR . 1 SEROUT 300 ms KEY UNTIL ;
{ second Propeller Chip with 915 MHZ transmitter running the code below. }
pub TS1 9600 SERBAUD
BEGIN
1 SERIN . 300 ms KEY CR UNTIL ;
Hi Peter,
The below code is running on two Propeller Chips, one as a tx and one as rx. The data that is transmitted is different on the receive side. tx-> 123
rx ->249
tx ->255
rx->255 (this works)
Thanks again Ken..
{ First Propeller Chip with 915 MHZ transmitter }
word hot
123 hot W!
pub TS 9600 SERBAUD BEGIN hot W@ DUP CR . 1 SEROUT 300 ms KEY UNTIL ;
{ second Propeller Chip with 915 MHZ transmitter running the code below. }
pub TS1 9600 SERBAUD
BEGIN
1 SERIN . 300 ms KEY CR UNTIL ;
It is easy enough to play a bit more ...
Make hot a byte and increment it every loop.
Also make the second loop a bit faster than the first.... just in case.
Tachyon is made for experimenting....
Many times faster than looking up the documentation ... or asking ;-)
Addit:
Or get really advanced ;-)
And put the sender ìn its own cog
And run the receiver on the first prop
Comments
Jim
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.
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.
In VGA.FTH you can find an example:
Then vgapars is the address of a data structure that in this case holds the setup parameters for VGA.
So if you have a simple variable then just pass the address of that variable
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
I compiled it to a binary:
converted it to hex:
and added the SAVEROM command:
Here's the resulting output:
Instead of AAAA.AAAA, testvar value is 0000.0000
Where am I going wrong?
I suppose I could process shorter strings and also make sure we get a success/fail response.
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?
WRFLASH writes 'value' into the flash at 'address'
I can then 'select all' and paste a la EXTEND...much more sensible
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.
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.
Did you ever create the code to use the counters to measure incoming PWM signals?
Jim
I have a +P8 IOT5500 set.
I try to learn Tachyon.
I use the recipe:
* Kernel
* EXTEND
* P8 in more/hardware headers/
* EASYFILE (combined SDCARD + EASYFILE)
* COMPACT
* BACKUP
* EASYNET (combined W5500 + EASYNET)
I start install NEON, with BST and 5r4.spin. loading , working minimal.
I can load EASYFILE with serial com, it is working.
Then I try to install the last (more/hardware headers/) P8.FHT file from dropbox, but this give errors.
After you load the Prop with Tachyon5r4.spin you should load EXTEND, then EASYFILE then RECLAIM private headers, then load EASYNET and optionally RECLAIM private headers. Paste in the SDPINS and WIZPIN configuration and BACKUP. I will test this out myself just to make sure.
I'll pm you shortly with some updates and other info too.
after EASYFILE, reclaim give "Reclaimed 1,028 bytes ... "
Memory full I guess ?
I'm just getting around to checking it although it should have enough memory. I'll let you know shortly....
but using the +P8 bin original file, I can read the SD card(A).
With Neon, I do not have the SD(A)
EDIT: I do not have the same SD(A) card of 8G, but an other SD(B) of 32G works in NEON?
In ESYFILE.NET I see "pub SDPINS ( ce-miso-mosi-clk -- )"
Is this correct with " &27.24.26.25 SDPINS ( SD8 )" ???
For FTP, I do not know where to put the two command. At top of the file ?
Thank-you
BTW, your SD looks a little strange since it is reporting a sector read speed + latency of almost 10ms plus it sounds like it is not formatted. Just try MOUNT again and then list the directory as maybe this card is really slow and we may need to adjust some timeouts to compensate.
For reference, this is my Sandisk 8GB.
Now I have tried from your zip file, and it will still not succeed in making a SAVEROM.
I can see that some words are removed, including GET8 and roms, and maybe more that are used in SAVEROM.
When I use the binary file, SAVEROM works well.
In the one that doesn't works: 1A00: EXTEND Primary extensions to TACHYON V5 kernel - 18104-0900
In the one that works: 1980: EXTEND Primary extensions to TACHYON V5 kernel - 180814-1145
Is it possible to get a copy of the EXTEND.FTH that works?
when I look @ the terminal the port numbers are strange.
I set " 1 SOCKET 21 PORT!" but get PORT 32292 on the terminal ?
I can't reach the Wiz using FTP.
... id --> ok
... ifup -->
*** Tachyon Forth EASYNET Network Servers and EASYFILE File Server ***
NETWORK STATUS:
LINK *UP*
HARDWARE: WIZnet W5500 V4
SRC IP &192.168.0.99
MASK &255.255.255.0
GATEWAY &192.168.0.1
MAC 02.FF.70.1A.C5.10.
SKT HH:MM:SS MODE PORT DEST TXRD TXWR RXRD RXWR RXSZ IR STATUS IP ADDR
#1 00:04:24 TCP 32292 18516 0000.0000.0000.0000.0000. 00 14 14 &0.0.0.0
#3 00:04:24 TCP 71 18516 0000.0000.0000.0000.0000. 00 14 14 &0.0.0.0
* Servers running *
ok
In !FTP the default port is not set, leaving user settings intact. Maybe just try that whole line without the comment for the moment just to make sure something else isn't screwy.
Why are they wrong?
The P8-W5500 set see my computer, but no web page and no FTP ?
Serial terminal:
REBOOT -->
Propeller .:.:--TACHYON--:.:. Forth V5r4 NEON 540181011.1000.[5n
CODE:$4EB2 = 19634 bytes
NAME:$55FC = 7684 bytes
DATA:$78EA = 986 bytes
FREE: = 1866 bytes
Data Stack (0)
CARD: SC32G SD03.80 #5D44.2C2C 2018/10 !C0FF.80C3 1,482us
FAT: #6435.3434 NONAME FAT32 31,910,789,120 bytes (32kB clusters)
*** Tachyon Forth EASYNET Network Servers and EASYFILE File Server ***
NETWORK STATUS:
LINK *UP*
HARDWARE: WIZnet W5500 V4
SRC IP &192.168.0.99
MASK &255.255.255.0
GATEWAY &192.168.0.1
MAC 02.FF.70.1A.C5.10.
SKT HH:MM:SS MODE PORT DEST TXRD TXWR RXRD RXWR RXSZ IR STATUS IP ADDR
#0 00:00:02 TCP 18516 57895 0000.0000.0000.0000.0000. 15 14 14 &192.168.0.58
#1 00:00:02 TCP 32292 59138 0000.0000.0000.0000.0000. 05 14 14 &192.168.0.58
#3 00:00:02 TCP 71 18516 0000.0000.0000.0000.0000. 00 14 14 &0.0.0.0
* Servers running *
...
When I load the sensors file it works fine. The problem is the second file it gets overridden by the display file and stop working.
Thanks Ken
The below code is running on two Propeller Chips, one as a tx and one as rx. The data that is transmitted is different on the receive side. tx-> 123
rx ->249
tx ->255
rx->255 (this works)
Thanks again Ken..
It is easy enough to play a bit more ...
Make hot a byte and increment it every loop.
Also make the second loop a bit faster than the first.... just in case.
Tachyon is made for experimenting....
Many times faster than looking up the documentation ... or asking ;-)
Addit:
Or get really advanced ;-)
And put the sender ìn its own cog
And run the receiver on the first prop