Shop OBEX P1 Docs P2 Docs Learn Events
Questions about PASM2 and register allocation (flexspin specific, maybe?) - Page 2 — Parallax Forums

Questions about PASM2 and register allocation (flexspin specific, maybe?)

2»

Comments

  • @TMM said:
    Does COGINIT always copy 504 longwords? The documentation just says it'll "start" I was vaguely assuming that there was some hidden magic to tell the cog how much data to copy. But reading the COGINIT page in the PASM2 doc suggests you only give it a start address. I figured it "couldn't be that" because the docs say it completes in 2-9 instructions! How can copying 504 longwords only take so few instructions! But I'm guessing then that that is only the cost on the calling cog, and there will be some delay (presumably of 63 - 70 clocks?) before the new cog starts executing code?

    Hi @TMM, you was interested in the exact delay for initializing of a cog. I wrote a little program to measure it. You can use the FlexProp app to run it on your board.
    You need to enable the debug option (P2 only) and for easy use ANSI or PST terminal in Options menu before. Then use "Compile and run" from Commands menu.

    The delay is more as you would think. Unfortunately, I cannot explain why.

  • evanhevanh Posts: 16,901
    edited 2025-11-09 01:53

    That's quite a lot. Certainly many more times what it takes to read 504 longwords. I was expecting around 700-1000 ticks. Something to keep in mind I guess.

    EDIT: Hang-on, I'm getting a consistent 42167 ticks with my Eval board. That's a massive difference from 300k!

    Cog0  INIT $0000_0000 $0000_0000 load
    Cog1  INIT $0000_0010 $0000_0000 load
    Cog1  cog1 initialization: cog1:delay = 42_167
    

    Ah, the debugger setup for cog1 is probably stealing lots before the user code runs ...

  • Yes, when a cog starts up the debugger is first executed if loaded. This prints the "Cog N INIT" message. Printing to the serial console, in the grand scheme of things, is very slow. Only after that can the user code run.

Sign In or Register to comment.