Shop OBEX P1 Docs P2 Docs Learn Events
Parallel processing & ASM — Parallax Forums

Parallel processing & ASM

PatricePatrice Posts: 5
edited 2008-07-09 09:01 in Propeller 1
Hello,
This is probably a trivial question for someone who knows.
I am just stuck trying to make a simple external object·in ASM running in parallel with a simple update of the entry.
To summarize, I create the simplified example in the attached zip.
Thanks if someone can take the time and have a look

Patrice

Comments

  • AleAle Posts: 2,363
    edited 2008-07-07 11:06
    In your asm version... you do not wait !.

    For such small programs, maybe you can post them with the code tags. Unzipping is no problem, Unicode from windoof is.

    edit: fixed
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2008-07-07 11:28
    When you call AnalogueOutput in Inq-Daq2-ASM it gets stuck in the spin repeat loop in that function. Remember that this spin code is not running in another processor, only the asm passed to the cog with the cognew is.

    Graham
  • PatricePatrice Posts: 5
    edited 2008-07-07 17:00
    Thank you, but but it does not seem to make it clearer to me.

    Ale, Adding waitcnt in the asm loop does not seem to change the problem, unless I do it wrong.

    Graham, when the spin repeat loop is suppressed, it is not better.

    I am sorry, but I think that I would need a simple example.

    In fact, I tried to find an example of the same configuration as what I tried: An external object with cognew runninig asm, updating continuously a variable used by a main file.
    In the examples I found, cognew is often launch from the main, and when cognew is launch from the external object, there is no asm but in secondary methods.
    Maybe, I will have to keep it in the spin form solution.
  • TimmooreTimmoore Posts: 1,031
    edited 2008-07-07 17:13
    The problem is that your 2 versions act differently. In your spin code in Inq-Dac2 analogueoutput creates a cog and returns. Your asm version must do the same, analogueoutput must create an asm cog and return. The code that is in SortieAna spin code must be in your asm code - so rewirte the repeat loop in analogueoutput in asm and run it in the asm loop
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2008-07-07 18:23
    I did not say that the repeat loop was the only reason it does not work but it will make the program hang. I was trying to help you find the answer not give it to you.

    In the spin code you send

      repeat
        frqa := 131_072 * long[noparse][[/noparse]addrV]
        waitcnt(5_000_000+cnt)  
    
    



    To a new cog using cognew. In the assembly version you send your asm code to a new cog but run:

      repeat
        frqa := 131_072 * long[noparse][[/noparse]addrV]
        waitcnt(5_000_000+cnt)  
    
    



    In the main cog because it was not sent to a new cog with cognew.

    As Tim rightly says this repeat loop wants to be written in asm and incorporated with the rest of the asm you have written, or sent to yet another cog which would allow the program to flow back to the main loop.

    Graham
  • PatricePatrice Posts: 5
    edited 2008-07-09 09:01
    Thanks to you all
    Trying to apply your advices, I have not found the solution with the same objects and methods configuration, not in ASM anyway.
    Some other tasks calling me, I have to leave this for a while and come back to it later...

    Patrice
Sign In or Register to comment.