I had a parallel ks0108 that I wanted to use and SPI seemed to have the fastest refresh rate. The draw time is 400ms if every byte has to update but the average rate is less than 300ms down to 150ms. I use a double buffer to check if a byte needs updated and it can skip over what doesn’t change.
It uses a couple shift registers with their latch tied to the SPI SS pin. I shave off some more time by also tying the SPI SS to the Glcd clock/enable. The shift registers take about 50ns to latch so I use a few invert buffers to delay the Glcd clock by about 500ns. There are shift register bits left over for backlight control.
I’ll put it on the wiki when I finish in a few days. The speed was still too slow because it had to flip the SS pin every 2 bytes. I decided to try an auto latch method and it immediately doubled the speed then some software adjustments made it 5x faster. Now it’s able to stream a massive buffer to parallel without stopping. The only thing left to do is switch the 2 slow 4017 counters with a single faster 4516 hex counter and I may be able to push the SPI clock higher.
Now that I had the hardware sorted I optimized the drivers and it can draw the screen in 15ms. I created a BMP loader that can load standard 1bit files and convert to optimized buffer objects. They load in 10ms which can stream directly to the screen in real time at 15fps minimum so only a single 1k load buffer is needed.
The invert buffers were added based on the timing shown on the datasheets. The LCD clock and shift register latch at about the same speed but the display needs the clock held around 450ns.The 4 buffers add about 500ns for the display while the registers are already loading the next cycle because the data can stay latched while loading.
I know the current design is bottlenecked with the 4017 counters because based on the datasheet they can barely handle 2mhz at 5V. The slight voltage drop when usb powered makes it even more unstable. Replacing those with a single 4516 will be much more stable and possibly let me push the SPI clock to 4mhz. It’s technically not what the 4516 is really used for but it counts to 16 and that’s all I need.
@ IanR It never crossed my mind about having multiple headers on a single shield. Since the control register pins are all assigned in software, it can easily control multiple display configs. The invert buffer even has a few extra available to add a flipped clock output or extra delay if needed.
If you need more speed why don’t we put an MCP23s17 spi - 16 i/o converter on it.
That will run up to 10 mHz, as for inversion of pins, its done in software.
The MCP23s17 has more overhead though you might not want to complicate things.
@ Brett…I don’t use eagle, but the gerber files are all the same. Yes I wil post them
I think the port expander would come out about even because of the extra instruction bits needed but it’s definitely worth testing. The advantage of an external counter is that it can clock the display without sending the extra instructions through the port expander. It basically cuts the amount of data that needs transfered per frame in half so even a slower clock speed can end up being faster.
The SPI speed probably can’t help much more even if it is faster because it can refresh now in 15ms at 2MHz and 4MHz only drops to 10ms. The last few speed improvements have come down to software adjustments at this point.
I know once I get it on the wiki somebody else will find plenty of ways to optimize the code and should get it to a 7ms refresh even at the 4MHz speed. There are some functions I haven’t even touched beyond just getting them to work. The last few bits are being finished now so I can finally start putting everything up.