Delay needed after RDFast?
Noticing some randomish stuff occasionally coming out of the FIFO in this LCD driver being worked on...
It appears that since working repeated rdfast with 800 byte buffer, not divisible by 64, causes FIFO to choke?
Not seeing anything in documentation that suggests that a delay is needed.
But, searching the forum finds this one comment from @Wuerfel_21 that suggests it is:
https://forums.parallax.com/discussion/comment/1558402#Comment_1558402
Whether or not this problem shows up seems to depend on the alignment of the buffer in HUB, in some way that can't figure out...
Don't really know what's going on here, but one solution might be to make the buffer 800x2 bytes and use rdfast for every two lines, so is divisible by 64?
It's very strange. Wish there was P1 style documentation for every P2 assembly instruction...
Comments
Here's that code with some nops after rdfast that seems to fix the problem above:
Note: Was thinking the $8000_0000 might remove the need for delay, but doesn't seem to...
Could just be that the LCD driver hardware has some relationship to the software that is not being understood...
Seems can fix the issue by flipping the polarity of the pixel clock pulse:
pinstart(LatchPin, P_Pulse | P_OE |P_INVERT_OUTPUT , 2<<16+4, %01) ' pinstart(PClkPin, P_Pulse | P_OE , 2<<16+4, %01)
Seems to be working with no delay when the P_INVERT_OUTPUT is removed from PClkPIn Pulse starting.
Guess that means it's really a hardware issue...
Might have to break out the scope after all...
Real problem might be that Pulse Smart Pins are running free and not synchronized well enough with the pixel output.
Guess might need to move the pinstart functionality into the assembly driver...
Still, maybe there is no way to get two Pulse mode smart pins exactly in sync?
Addpins might be solution there...
Seems like that could work. You can even set them up in Spin, then disable them by floating the pins. In your assembly driver you can restart them by using drvl with a pin group.
Thanks @JonnyMac That does sound like the easy way to go.
I see in the spreadsheet that RDFAST takes as many clocks as it needs to prepare the FIFO.
So, don't think any extra delay is needed.
Just need to get my smart pins in order...
Ok, think it is fixed like this in assembly now:
Output seems stable. Hope all fixed now. Guess need more testing to say for sure...
Very lucky that Latch Pin and Pixel Clock Pin are next to each other...
For a 'fast' RDFAST with D[31]=1 you must wait until the FIFO starts filling before doing a RFxxxx. A wait of 14 cycles between RDFAST and RFxxxx is enough or seven 2-cycle instructions (add one cycle if address is not long-aligned). For a 'slow' RDFAST with D[31]=0 no waiting is needed as the RDFAST doesn't end until FIFO starts filling.
I think your problem was related to the smart pins.
Thanks @TonyB_ starting to remember how rdfast works now…
IIRC alignment is irrelevant, 14 cycles is always safe.
Don't use ##$8000_0000 if you don't have something useful to fill in those instruction slots with.
You're right. Not sure what I included the comment in brackets as I've done loads of testing with byte- or word-aligned addresses and 14 cycles always works, perhaps because spreadsheet says RDFAST takes 10-17 cycles. I've edited my original post.
The pulse/transition smartpin modes internally begin cycling on rising edge of DIR. The value in Y register has no bearing on their timing. It's painful for programs to manage and is the primary reason why my streamer+clock I/O code always looks similar to this: