Shop OBEX P1 Docs P2 Docs Learn Events
jamming of code — Parallax Forums

jamming of code

BeginerBeginer Posts: 21
edited 2010-01-17 18:58 in Propeller 1
Could You advise me please why is my code malfunction? I have program in assy what is full functional, but only when its running alone.
I need call this code from main program (in spin). Main program were running good earlier too. But when I call from this code assy code,
propeller gets jamed. Its maybe heavy say it so uncertainly, but how possibles there are to hapend this state?
Its due to bad writing to main memory? Or maybe bad strating or stoping cogs? Is possible to hapend some "crossing" cogs id?
I think, I dont use full count of cogs. I dont know where is reason.

Thanks a lot

Comments

  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-01-16 23:44
    You will have to give a bigger clue to what the code is before anybody will venture an answer.

    A completely open guess from one who knows little, would be that the "stack" and/or general memory is bleeding away. They are the same thing, as there is no separate stack area (I think).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • MagIO2MagIO2 Posts: 2,243
    edited 2010-01-17 00:23
    It's most likely the stack.

    You main has the whole free HUB-RAM as stack. But a program started in another COG only has the stack you give it. If your program is calling functions and having local variables it might need more stack than you gave it an mess up code.
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-01-17 09:22
    Beginer,

    the BEST way to get help here in the forum is to attach your COMPLETE code to a posting.
    Even if your program is REALLY BIG this will take only 0,1MB. Half a peanut on the forum server.

    look at the attached picture how you create an archive with ALL files needed in your project right away with the propellertool itself
    and how you can attach it to a posting.

    Without attaching your code it will take FIVE times longer until you have your program running.

    best regards

    Stefan
  • BeginerBeginer Posts: 21
    edited 2010-01-17 10:38
    I sent my two objekts. You could change and fill anything is possiblle.Original I have saved.

    Thanks
  • BeginerBeginer Posts: 21
    edited 2010-01-17 10:44
    And complete packeged program is here...
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-01-17 13:17
    Wyh didn't you use the archive-function of the propeller-tool

    this archive function adds a readme.txt-file that shows the hirarchical structures of the objects
    now I have to GUESS wich is your top-object

    and as you use names that are not english it is even harder
    so if I would like to find it out I have to load EVERY single file and do a compile looking when has the structure the most complexity

    No I won't do that

    add another post with the archive created with the PROPELLER-Tool

    please add a comment that describes IN DETAIL wich programs are working and if you do WHAT exactly so it stops working
    and what SYMPTOMS you see does it just stop or what EXACTLY is happening
    As your code is not in english it is much harder to understand what your code is doing
    add as much additional information as you can


    best regards

    Stefan

    Post Edited (StefanL38) : 1/17/2010 1:26:56 PM GMT
  • AleAle Posts: 2,363
    edited 2010-01-17 13:39
    From what I see there is no connection between code_main and code2. Can you clarify please a bit as StefanL38 explained ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Visit some of my articles at Propeller Wiki:
    MATH on the propeller propeller.wikispaces.com/MATH
    pPropQL: propeller.wikispaces.com/pPropQL
    pPropQL020: propeller.wikispaces.com/pPropQL020
    OMU for the pPropQL/020 propeller.wikispaces.com/OMU
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-01-17 14:20
    from a short look into your code. You seem to have the adresses hardcoded (adresa1 to adresa5)

    You should define your variables with wich you communicate between the PASM-cog and SPIN-cogs
    as first variables as a BLOCK and then you should start the PASM-cog with the second parameter containing the adress
    to the FIRST of these variable

    instead of

        ok := Cog := cognew(@Rozbeh, 0) '+ 1
     
    
    



        ok := Cog := cognew(@Rozbeh, ADRESS_of_First_variable) '+ 1
     
    
    



    I guess that is DelkaPuls_L but I can't find a corresponding variable in the SPIN-code

    so this means the program should calculate the adresses at RUN-time
    to make sure that you are using the right adresses.

    take a look into the PASM-driver of FullDuplexSerial how the adress-caclulating is done (for a long add 4)

    Somehow the adress of this spin-variable-block has to be transported down to
    the object code2.spin which does start the PASM-cog.
    For this I would add a paremeter to the start-method

    PUB Start (adressPointer): ok
    
        'Stop
        ok := Cog := cognew(@Rozbeh, adressPointer) '+ 1
     
    
    



    best regards

    Stefan
  • BeginerBeginer Posts: 21
    edited 2010-01-17 17:43
    I have to create ADRESS_of_First_variable if i use hardcoding of adress?
  • BeginerBeginer Posts: 21
    edited 2010-01-17 17:54
    What did You thought it ? "I guess that is DelkaPuls_L but I can't find a corresponding variable in the SPIN-code " I think, variables in spin and in assy neednt be same.Or say it false???
  • StefanL38StefanL38 Posts: 2,292
    edited 2010-01-17 18:12
    No you should avoid hardcoding adresses.
    One idea what MIGHT causes the problem is the fact that,
    if you add the PASM-code, the adresses in HUB-RAM are changing.
    And then if your PASM-code does a WRLONG to HUB-RAM it is overwriting something else and that this storing the value at an adress that is occupid by something different makes the program crash.

    So INSTEAD of using hardcodes adresses you should use adresspointers that are calculated at RUNTIME to make sure that the adresses are still valid
    regardless of any changes in the SPIN-code or the PASM-code.

    You don't need to use the same names in SPIN and PASM. It is just ME that I don't know what the "DelkaPuls_L"-label is good for.

    As you provided only very little information I was GUESSING that the label "DelkaPuls_L" corresponds with a SPIN-variable.

    Without providing MUCH MORE information about your software what it is doing especially about PASM-cog and SPIN-cog communication over HUB-RAM
    the forum won't be able to help you.

    best regards

    Stefan

    Post Edited (StefanL38) : 1/17/2010 6:19:21 PM GMT
  • BeginerBeginer Posts: 21
    edited 2010-01-17 18:58
    and could you fill it into code2.spin ? I understend your idea, but I dont know what do it now...
Sign In or Register to comment.