Can you use interrupts with hubexec?
Rayman
Posts: 14,646
I'm having more interrupt issues...
Trying to merge two cogs into one by having one be interrupt driven.
But, it seems that having any hubexec calls in the non-ISR code breaks the interrupt system...
Not sure what's going on...
Update: Found the problem! Had nothing to do with interrupts... I had a rdfast in progress and the hubexec call trampled on it...
Trying to merge two cogs into one by having one be interrupt driven.
But, it seems that having any hubexec calls in the non-ISR code breaks the interrupt system...
Not sure what's going on...
Update: Found the problem! Had nothing to do with interrupts... I had a rdfast in progress and the hubexec call trampled on it...
Comments
This code uses cogatn interrupts and hubexec.
Seems to work Ok.
Might be helpful
It seems that interrupts do not activate during waitx instructions...
So, maybe it is possible the interrupt is constantly being called?
vs a non-waitx delay
If the ATN flag was not being cleared the leds would all flash at the same rate.
This lights up P60 led on eval board.
I think that means that the interrupt does not clear the ATN flag...
Says this:
"Strobe" sounds to me like pulls ATN down (if up) and then raises it again.
Actually, doesn't "strobe" usually mean to pulse high and the bring low after?
I.e., if the ISR doesn't clear ATN flag and returns with flag still high, the interrupt is not triggered again.
What does COGATN actually do? What do you mean be "Strobe" in the spreadsheet?
For example, I don't know why I need a waitatn in my ISR that is triggered by ATN, but I do.
This should have no affect because Chip is saying that the attention trigger of ISR is different than the attention flag.
Also, these two version of the beginning of my ISR should have identical results, I'd think, but they don't:
This one works fine:
This one seems to have occasional bad delays:
Even stranger, adding a nop before pollatn seems to fix that second version:
It is as if there is some delay between the atn interrupt ISR beginning and the ATN flag being set as seen by pollatn...
This also works:
This shows that all the ISR needs to do is clear the ATN flag, it doesn't have to wait for anything.
I think there must be some hidden timeout on the interrupt attention mechanism...
If there are some low number of clocks between COGATN triggers (I think I have 256 clocks between calls), you must manually lower the ATN flag or it won't work...
Seems that during the visible scan line, I'm calling COGATN every 256 clocks or so.
But, looks like my ISR needs about 200 clocks to complete.
So, there's only about 50 clocks between when ISR ends and COGATN is called again.
My code goes haywire when I make a hubexec call even without any interrupts
I've got a rdfast in there that must be getting trampled on by the hubexec call...
Your snippet had the RETI instruction positioned in ColorInterruptOnly, which appears to be outside the ISR. How was that meant to work? https://forums.parallax.com/discussion/171256/switching-a-cog-from-waitatn-triggered-to-attention-interrupt-triggered/p1