Streamer NCO rollover event misfire
ozpropdev
Posts: 2,792
in Propeller 2
Hi All
I've been playing with using smartpins and streamers.
To syncronize the smartpin to the streamer I needed an accurate reference of the streamer activity.
Luckily the event mechanism has a event that solves the problem.
By setting up a interrupt set for "Streamer NCO rollover" and toggling a pin, an accurate reference can be used to "tune" the code for correct sync.
When verifying the output on my logic analyzer I discovered an issue.
It seems that once the streamer has been started, when it's ready for additional commands the NCO rollover event fires every 14 clocks until a new command is received.
Here's the tested code.
Also the 14 clock figure doesn't seem to be related to the streamer NCO frequency.
I've been playing with using smartpins and streamers.
To syncronize the smartpin to the streamer I needed an accurate reference of the streamer activity.
Luckily the event mechanism has a event that solves the problem.
By setting up a interrupt set for "Streamer NCO rollover" and toggling a pin, an accurate reference can be used to "tune" the code for correct sync.
When verifying the output on my logic analyzer I discovered an issue.
It seems that once the streamer has been started, when it's ready for additional commands the NCO rollover event fires every 14 clocks until a new command is received.
Here's the tested code.
test_code loc ptrb,#@capcon wrlong #1,ptrb 'start capture cog or dira,mask andn outa,mask waitx #80 outnot #marker1 'setup interrupt outnot #marker1 mov ijmp1,#ncoro_isr setint1 #12 mov pa,#60 'delay after int enabled djnz pa,#$ outnot #marker1 outnot #marker1 setxfrq ##$0200_0000 'start streamer rdfast #0,##@buffer xinit ##%0001_0000_0001_0000 << 16 | 3,#6 'start 4 bit read xcont ##%0001_0000_0001_0000 << 16 | 4,#6 'start 4 bit read outnot #marker2 'wait for streamer busy pollxfi wc 'A WAITXFI world blocks interrupts if_nc jmp #busy outnot #marker2 mov pa,#20 'delay djnz pa,#$ xcont ##%0001_0000_0001_0000 << 16 | 5,#6 'start 4 bit read outnot #marker3 'all commands sent outnot #marker3 mov pa,#200 'delay djnz pa,#$ outnot #marker1 'all done outnot #marker2 outnot #marker3 outnot #marker1 outnot #marker2 outnot #marker3 finished mov pa,##8000 'larger delay djnz pa,#$ cogatn #1 'signal capture cog cogid pa cogstop pa ncoro_isr outh #marker4 'streamer nco rollover event outl #marker4 reti1 mask long |< marker1 | |< marker2 | |< marker3 | |< marker4Note that after the interrupt is enabled their is no XRO events with an empty streamer.
Also the 14 clock figure doesn't seem to be related to the streamer NCO frequency.
Comments
If I'm reading this right then, inside the ISR, a GETINT instruction should always be returning a value of $0003_1001 only.
Edit: Need to do further test on this. I need to add some extra stuff to capture additional data.
ie how should this work, to give the most 'usable' operation ?
If the interrupt had been configured for mode 10 "Streamer is ready for another command" it should only fire when this state changes.
Thanks, OzPropDev, for discovering these problems.
When the streamer's two-deep command buffer FIFO runs empty, the NCO stops, leaving its MSB set, causing a perpetual 'rollover' state.
I changed the Verilog to qualify the NCO's MSB with the internal 'active' signal, to generate an improved 'rollover' signal. This way, it doesn't hang high. This prevents perpetual interrupt retriggering when the streamer runs out of commands.
Here is a new FPGA image for the Prop123-A9 board:
https://drive.google.com/file/d/0B9NbgkdrupkHZjdkdkZPdU1BRXc/view?usp=sharing
This works as one would expect.
NOTE: I am recompiling this image now, because I left some debug-pin stuff in this version. P4..P15 are stuck as outputs and P15 reflects the internal streamer 'rollover' signal. I will be updating and replacing this file soon.
I'm probably a bit late but can you make it a 4 cog version?
https://drive.google.com/file/d/0B9NbgkdrupkHcjZuTWVTZFp3MUk/view?usp=sharing