COGATN causes erratic Pnut F11 download behaviour
ozpropdev
Posts: 2,792
in Propeller 2
Chip
In the included code which generates a VGA image if I include the COGATN instruction it randomly fails after a F11 download from Pnut.
If I remove the COGATN instruction it downloads OK every time.
Target board is P123-A9. Any clues?
In the included code which generates a VGA image if I include the COGATN instruction it randomly fails after a F11 download from Pnut.
If I remove the COGATN instruction it downloads OK every time.
Target board is P123-A9. Any clues?
spin
3K
Comments
No video output but background code runs oK.
Thanks for conveying this problem.
I just ran the P123-A9 again and it failed 5 times in 20 downloads.
Fails ~1 in 5 downloads.
What is the RESI1 instruction?
What will the other Cog do if it never receives it's attention event?
In the above code the COGATN is only half of the attention mechanism.
I hadn't got to the fun part of polling it yet from another cog.
Next question is: What happens if that event is set more often? Does the chance of the wrong Cog being loaded also occur more often?
It never is loaded anywhere else.
The code appears to hang at the COGATN instruction which explains the no video output symptom.
I think the issue is a conflict between the interrupt driven video driver and COGATN.
If I modify the driver to run without interrupts the code runs fine and COGATN works nicely.
Change the line to COGATN #%10 instead and see if that works. As you have it now, the cog is setting its own ATN flag.
When I put cogatn into Chip's ntsc_256_interrupt.spin inside the field loop, it seems fine: 10 out of 10.
I'm not setup for VGA right now. Try substituting a nop for your cogatn and leave the interrupts as they were... timing issue?
No. All a cog sees is the event that's set by the logical-or of the associated COGATN bit from all of the other cogs (including itself, I'm guessing).
Note that most events/interrupts have been renumbered. Be sure to use the latest documentation.
...needs to become something like...
You were just running out of time to do the first XCONT before the streamer buffer fully emptied, then requiring TWO, not just one, XCONT to carry on the show.
Which raises other questions...
Why did the code break on the latest build, or was it just noticed on the latest build ?
Why is there this effect " it failed 5 times in 20 downloads." ?
Is reset exit not always the same ? - ie can something download does, vary how P2 exists from reset ?
It was right on the edge. If you change that #10 to #9, it fails every time. Lower-slice versions have lower latency which get them into the safe zone, in the case of this software example. The reason there is any uncertainty, at all, is probably due to serial receiving in relation to the egg beater. There is no bug here, just software cutting timing too close.
I wonder how that " it failed 5 times in 20 downloads" varies over many resets, of the same download ?
Ideally, you want every reset exit to be the same, and to have no dice effects, as bugs that (eg) vary with download, but not reset, are much harder to find.