Here is what I had in mind originally with my SPI RAM as graphics frame buffer and why I didn't do that.
An external SPI RAM acting as a frame buffer is attached to the SPI.
Here is the interesting part about the SPI RAM. There is an internal address generator, a shifter and a state machine to shift out the memory. That's pretty much most of the blocks in a video frame buffer nicely contained in a simple 8-pin package.
SPI SRAM timing |
The ARM has full access to the RAM when the display is inactive. The quad AND gates are used to buffer the signals as well as hide the activities from the monitor as some of them expect the signals to be at 0V. The "Enable" signal is what I used to control the "AND" gates.
Horizontal scanline timing |
SPI SRAM Quad Serial mode timing |
Draw backs
Unfortunately, most of the SPI RAM are only rated for 20MHz. There are also some fancy non-volatile SPI memory (FRAM/NVSRAM) that are rated for much higher clock speeds, but they are more expensive and might have limited write cycles.Dangerous Prototype uses the 23LC1024 in their Logic Pirate and managed to overclock the heck out of it. Coincidentally, they use the quad mode for "sniffing" the logic signals and SPI mode for reading it out.
The 23LC1024 being a higher density is probably built with a smaller geometry. There is also a 23A1024 for 1.7-2.2V (1.8V technology?). The 20MHz timing for the 3.3V version is likely to be more conservative.
The ARM have limited access to the SPI RAM and only when RAM is not driving the video. This happens in (525-480) = 45 lines 60 times a second. Furthermore, the SPI RAM is serial in nature with an overhead of 8-bit command + 24-bit address. i.e. 32 SPI clocks * 2 = 64 CPU clock cycles just to start a command and only 1 bit wide bus. I'll let you do the math.
Even the on the fly rendering that uses up 51% of the CPU cycles, but have full 32-bit 0 waits access sounds attractive. This was one of the reason why I tried out that rendering idea.
Hi,
ReplyDeleteI stumbled across this post and I noticed that it's quite recent.
I've been toying lately with the idea of converting an old monitor to an irc client for my local hackerspace (hackerspacenijmegen.nl). I could of course use a raspberry pi, but I challenged myself to find something simpler ;-) So I was thinking of an esp8266 combined with something that can do the bit-banging of a vga-signal (the esp is fast enough (80MHz) but the wifi libraries on-board will use interrupts that will prevent it from creating consistent vga frames).
So I was thinking of using SPI flash. Check out, for instance, these winbond flash ic's. In particular the w25q__ series: http://www.winbond.com.tw/export/sites/winbond/product/files/Automotive-Flash-PSG-080717.pdf
They can store plenty of data and are readily available on aliexpress.com. They feature the same continuous read-mode that you describe. They can even churn out 4 bits at a time at upto 104 MHz. I was thinking the 4 bits could even be used to make color, or even shades using a resistor ladder or something. I believe that 1024x768 should be doable.
Are you still pursuing this direction or are you definitely going for the stm32 bit-banging approach?
Do you see an opportunity to share some development work (maybe we could create a library that does this kind of stuff, others might benefit from that too). As far as I can tell this is a really great idea and noone has made it before.
Notice the "Original post date: 03/09/2016". It was two years ago before I started the project. Sorry that this has been moved to a blog site, so I haven't maintained the links.
ReplyDeleteMain project: https://hw-by-design.blogspot.com/2018/07/low-cost-vga-terminal-module-project.html
github: https://github.com/FPGA-Computer/STM32F030F4-VGA
I ended up with (overclocked) DMA SPI and hardware timer compare function for generating the video signals. The text is store inside a buffer (just like the old PC XT days). The CPU render the bitmap into a buffer on a scan line basis in real time and still managed to leave plenty of processing power to handle the terminal at 115kbps.
SPI FLASH has one major drawback - it is FLASH so there are limited cycles and slow write. SPI RAM is what you should look at if you want to further this direction. There are still the issue of needing to update the contents of the SPI RAM during horizon/vertical sync periods and a lot of memory copy for moving text.
My text buffer approach actually work quite well in the background. I have done a Matrix Clock demo to show how the library can be used.
https://hw-by-design.blogspot.com/2018/07/chibiterm-matrix-clock-demo-for-vga-text.html
FYI: Pm25LV040 datasheet SPI FLASH:
ReplyDeletetPP Page Program Time 2 (typ) 5 (max) ms
tEC Secter/Block/Chip Erase Time 60 (typ) 100 (max) ms
Guarantee 200,000 program/erase cycles per single sector
---------------------------------------------------------
You have to erase the entire FLASH page before you can program/overwrite data that are not in the erased state. SPI RAM on the other hand do not have these limitations as they can be written as quickly as you can clock in the data, no erase needed and unlimited cycles.
Ow, thanks. Those are some great hints.
ReplyDelete