Shop OBEX P1 Docs P2 Docs Learn Events
Need help debugging: Cog Locking up? — Parallax Forums

Need help debugging: Cog Locking up?

gpostgpost Posts: 5
edited 2010-08-31 07:01 in Propeller 1
Hello,

This is my first post. I have been working with the propeller for a little over a year now. I guess I would say that I know enough to be dangerous when it comes to the programing :)

Anyway: I am attempting to write my own debug message object that allows for two way communication on a serial port.

I have written my debug code, and a tester program. Everything is working great, except that when I send a string from my main code back to my test program, the cog seems to lock up. (The cog that is running the tester code, not the actuall serial debugger code) Trying to figure out what is causing the lockup.

See the attached code. You might also want to hook your propeller up to a hyperterminal to see the output.

Thanks for any insight into whats causing the cog to lockup.

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2010-08-27 17:34
    What exactly are we looking for?

    I changed my terminal pins to 31/30 and set the FullDuplexSerial mode to %0000 (don't need inversion). With that I just get debug messages on the screen.

    Can you clarify? What is supposed to happen and what happens instead?

    EDIT: I found that when you send a non-empty string followed by Enter from the terminal back to the prop debug output stops. Is that the lockup?
  • kuronekokuroneko Posts: 3,623
    edited 2010-08-27 18:31
    OK, in testControl_debug.spin you want
    debug.DBG_OUT([COLOR="Red"]@[/COLOR]dbg_command)  ' parameter is an address
    

    and in Control_debug.spin
    VAR
      [COLOR="Red"]LONG[/COLOR] currentMessage   ' must be able to hold an address (at least 16 bit)
       ...
                ' my_command is an address, so just pass it on
                BYTEMOVE ([COLOR="Red"]my_command[/COLOR], @shell_command, 16)
                Com.str([COLOR="Red"]my_command[/COLOR]) 'Com.str(@shell_command)
    
  • gpostgpost Posts: 5
    edited 2010-08-30 11:52
    kuroneko wrote: »
    EDIT: I found that when you send a non-empty string followed by Enter from the terminal back to the prop debug output stops. Is that the lockup?

    Thank you for your replies Kuroneko!

    Yes, that is the lockup I am trying to fix. I believe I have all of the pointers vs. addresses setup correctly (although it wouldn't be the first time I am wrong) I am seeing the strings that I am trying to send back through to the initializing cog printed correctly, however immediatly after I send the command (string) the testControl_debug code will send one more message, and then lockup. I am trying to figure out why that code is locking.

    The only thing that I can think of is that I am somehow writing over memory inapropriatly, but I can't figure out how.

    Any methods out therefor tracking the memory map during runtime?

    Thanks again!

    -Greg
  • kuronekokuroneko Posts: 3,623
    edited 2010-08-30 16:32
    gpost wrote: »
    The only thing that I can think of is that I am somehow writing over memory inapropriatly, but I can't figure out how.

    Any methods out there for tracking the memory map during runtime?
    I'm slightly confused. The fixes in post #3 should resolve your issue. Is that not the case for you?

    As for tracking memory corruptions, that's a tricky one to do at runtime. You're lucky in that you have visual clues as to when something goes wrong which is how I found the byte[my_command] vs my_command issue. The other thing was that the mainloop was supposed to display the command as well (missing @ and mismatched length).
  • gpostgpost Posts: 5
    edited 2010-08-31 07:01
    You are correct kuroneko,

    I had made some other changes in my struggle to correct the problem. After I restored to the version I Posted and made your edits, it started working.

    Thank you so much for your help!
Sign In or Register to comment.