Shop OBEX P1 Docs P2 Docs Learn Events
COGNEW has an unexpected 52 seconds delay to start? — Parallax Forums

COGNEW has an unexpected 52 seconds delay to start?

I am not sure if this is related, but I was using PropellerIDE to code in spin -- now I am using Notepad++ and use PropellerIDE only to flash the chip.

After doing some coding I discovered that the new program delays a particular cog start by 52 seconds. Just about what the clock cycle takes. This is how I call for the cog to start:

cognew (cog_laser, @stack_laser)

What could prevent a cog from starting right away? There is noting in the way that would influence this in may code. It is one of the cogs I load at the very beginning.

Comments

  • ErNaErNa Posts: 1,752
    That looks like a timer issue, means, your program waits for cnt and the hit comes when the counter overruns What happens in the worst case after 53 s
  • Cluso99Cluso99 Posts: 18,069
    edited 2016-09-26 03:05
    Agreed, it will most likely be a timer issue where the code cannot execute before the waitcnt expires, meaning it will wait for another round of the CNT which is roughly 53 seconds (2^32 / 5,000,000 2^32 / 16*5,000,000 = 4,294,967,296 / 80,000,000 = 53.687... presuming 5MHz).

    If you post you code one of us will find your bug.
  • ErNa wrote: »
    That looks like a timer issue, means, your program waits for cnt and the hit comes when the counter overruns What happens in the worst case after 53 s

    The worst case is "the cog finally start" (which in may case is what I want!)

    I have code breaking due to tab = 8 spaces. Now I am cleaning up my code...
  • Thanks for the help - I emptied the cogs code and it load. There must be some other stupid mistake on my part...
  • JonnyMacJonnyMac Posts: 9,104
    edited 2016-09-26 04:25
    To be precise, a waitcnt missed its target and the cnt register had to wrap all the way around to hit the target again. At 80MHz this takes about 53 seconds.
  • Cluso99Cluso99 Posts: 18,069
    Thanks Jon,
    I have corrected my error - need more coffee ;)

    2^32 / 16*5,000,000 = 4,294,967,296 / 80,000,000 = 53.687... presuming 5MHz
Sign In or Register to comment.