Starting a cog to execute SPIN from assembly
Andrey Demenev
Posts: 377
Is it possible to start a cog to execute SPIN code from assembly? I have an application that requires all eight cogs to run assembly. At certain moment, I have to execute SPIN code to process data gathered by assembly code.
Comments
Found it in this thread: http://forums.parallax.com/forums/default.aspx?f=25&m=364841
Maybe the also attached SpinStart helps as well - did not have a look into it so far.
You really need all other 7 COGs to run continuously in parallel? Or do they spend most of the time waiting? I think it would be easier to swap COG-code instead of starting SPIN interpreters.
I have to run all 8 cogs with identical PASM code. They gather data to hub memory for some time, at high speed, then stop. After that, I need to transfer the data to external device. Possibly, I will go "everything-PASM" way - but first want to check if I can start the communication routine written in SPIN from PASM - it would be easier to code the communication in SPIN
Maybe you can improve the PASM-code, so that in the end you don't need all 8 COGs. For example there is a serial port object which allows 4 serial interfaces.
Post Edited (Andrey Demenev) : 10/26/2009 9:48:37 AM GMT
I am presuming you are sampling more than the available cog memory (480+ long samples)? I used 4 cogs to achieve a 12.5uS sample rate but only 480 x 4 samples. I was just sampling the 32 I/O pins. Of course 480 x 8 would be possible using all cogs.
However, for more samples you will have to use the hub, which you are obviously doing. If you are sampling bytes, you may find it faster/easier to block the bytes into longs and then write a hub long.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
I'd love to see how if anyone has acheived it.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Does that byte of memory hold "A", 65, $41 or %01000001 ?
Yes it does...
·
IIRC, the spin interpreter, which by the way is pasm, picks up the parameters (including the stack address), passes those the booter code which resides in hub ROM. So you have to emulate this sequence. The hardest part was figuring out where the spin code blocks reside to set the required parameters.
I have successfully restarted multiple different versions of the spin interpreter, but not from pasm. So it's part way there. I don't know enough about the binary to know what parameters the spin code requires to setup the call. But it is all in the spin interpreter and booter code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
Post Edited (Cluso99) : 10/26/2009 1:37:23 PM GMT
That's the code in booter.spin ... Should not be to hard to test that ...
PS: As you said all your COGs run the same code, so it might be wise to let only one restart the interpreter
Post Edited (MagIO2) : 10/26/2009 2:10:29 PM GMT
I think, finally I will have everything in PASM - the data gathering loops are short, leaving plenty of COG memory for communication code. Anyway, I have learned from your answers here, thanks a lot.