This Arduino shield will make an end to your 1st project being an LED to be flashed. Now you are able to connect a display (which we are all hooked to anyways) and generate a virtual LED that is going to blink in every color you have ever dreamed of.
Now seriously, the Arduino family of compatible boards is lacking a solid hardware support option to display images, animations or video. This board provides an analog composite video display with integrated frame buffer memory accessible through SPI or parallel bus. It will not display 4K video but somebody will hack it to run Doom, Joust or Ultra-Cricket. PAL, NTSC and VGA output formats are supported, resolution is up to 640x480 with reduced color count.
A 2Mbit SPI FLASH memory is available on-board.
Design data is published on my GitHub.
The heart of this design is the VLSI VS23S010D-L chip. It is a 1 Megabit SPI SRAM with Serial and Parallel Interfaces and Integrated Video Display Controller, which outputs a composite video signal.
Possible video resolutions, PAL and NTSC modes might be exclusive depending on the mouted crystal (4.433618MHz or 3.579545MHz):
The chip has a 3.3V interface, so a level shifter logic is required, which is done by a 74LVC4245A buffer, which is able to handle SPI Mbps speed better that a simple FET based level shifter. A footprint for a 512Kbit EEPROM for bitmaps and character memory is added, but is probably too slow for effective operation. On a suggestion of [kbdhog] the current version does have a 2Mbit SPI FLASH chip for better speed and memory size. Now I am dreaming of SPI DMA, which just gave me an idea of a small PLD and a parallel flash memory to implement that.
Rev3 of the board (with added SPI FLASH) is being designed, might be the final one if things go well. Writing SW is so hard in comparison. Currently NTSC 320x200 and PAL 300x240 resolutions are working with an identical color bar test image. This is important to have an unified RGB to YUV conversion table. Both resolutions have 8bit color depth. 640x480 resolution is being worked on now.
The circuit on the bottom left of the rev1 schematic is used to fill the 10cm x 10cm PCB space and left to the reader to figure out its functionality. ;-) I will end up with ~780 copies of this circuit which will last a lifetime or they might show up on Tindie.
1 Mbit SPI/8-Bit Parallel Bus SRAM with Video Display Controller
Finally I have got the animation demo with the famous Amiga Boing ball running. The video quality is not stunning, but it shows what is possible with very little program overhead once the memory is set up. Information on how to do this will be soon below in the instructions and the code is on Github.
Finally the Arduino library shows enough features and I have built and tested some modules. The boards have been partly assembled (everything SMD) and shipped from @Elecrow. I added the through hole shield connectors and RCA jack and programmed the character bitmaps into FLASH. Now I have opened my brandnew Tindie store and have stock for sale. Code and documentation can be found on my Github.
BTW, the manufacturing was flawless and communication with Elecrow was delightful.
The issue: The Arduino Mega has its SPI port mapped on pins 50 to 53, which is on the dual row header at the end of the board. Those pins are not accessible through are regular Uno shield. To use my Video Display shield (and any other shield that wants to talk SPI), this is what I did:
Connect the SPI communication signals through jumper wires to the shield.
SCK: Mega pin 52 -> Uno shield pin 13 - orange wire
MOSI: Mega pin 51 -> Uno shield pin 12 - brown wire
MISO: Mega pin 50 -> Uno shield pin 11 - blue wire
The slave select pin 53 does not need to be wired, as it is mapped as a normal GPIO in a normal Uno sketch. The picture for the pin numbers 50-51 on the Mega connector is misleading due to the parallax.
(The RCA connector is not in a ideal location for the wire jumpers. Here is a reason for another spin).
Make pins 11 to 13 on the Mega inputs or tri-stated outputs.
Add the define somewhere in the header file for the shield or at the beginning of the sketch
Add the code to disable the pins that are used by Uno for SPI in the setup() function
This was all I needed to do and the MEGA was happily configuring the Video Display shield and outputting the test patterns.
And the compile log told me, there is lots of memory available compared to the Uno:
Sketch uses 7498 bytes (2%) of program storage space. Maximum is 253952 bytes. Global variables use 424 bytes (5%) of dynamic memory, leaving 7768 bytes for local variables. Maximum is 8192 bytes.
The project made some progress in the last few months. I had board revision 2 manufactured by @Elecrow and got it to work with 'only' 2 wire mods. I had changed the voltage level shifter to a 74LVC4245 and added some protection to the video output. The 2Mbit Flash found a home on the board and is responding to SPI commands. And the IO voltage gets used for the level shifter, this makes the shield compatible to circuits that run with less than 3.3V. Also some progress was made on the software side. I have the configuration for NTSC 320x200 running in my own code. Display of the VLSI test image and text output is functioning.
Text output on my new 7" display. Now I can work on my desk instead in front of the 40" TV.
And a scope plot of a nice NTSC video signal displaying the color test image.
Todo: Add an instruction on how to generate a bitmap font and upload into Flash.
SW todo: Get a PAL configuration and higher resolution set up. Also image display will be a feature.
The folks at VLSI tech support are great. [Panu] and [Kalle] are a big help with HW and SW. They even sent a full Arduino sketch to configure the VS23S010. It does configure the chip corretlyf̶o̶r̶ M̶C̶G̶A̶ 3̶2̶0̶x̶2̶0̶0̶ w̶h̶i̶c̶h̶ u̶n̶f̶o̶r̶t̶u̶n̶a̶t̶e̶l̶y̶ m̶y̶ T̶V̶ s̶e̶t̶ d̶o̶e̶s̶ n̶o̶t̶ f̶u̶l̶l̶y̶ ̶u̶n̶d̶e̶r̶s̶t̶a̶n̶d̶.̶ B̶u̶t̶ i̶t̶ i̶s̶ c̶l̶e̶a̶r̶l̶y̶ v̶i̶s̶i̶b̶l̶e̶ t̶h̶a̶t̶ t̶h̶e̶ v̶i̶d̶e̶o̶ o̶u̶t̶p̶u̶t̶ w̶o̶r̶k̶s̶.̶ N̶o̶w̶ ̶i̶t̶ i̶s̶ j̶u̶s̶t̶ a̶ m̶a̶t̶t̶e̶r̶ o̶f̶ t̶h̶e̶ r̶i̶g̶h̶t̶ c̶o̶n̶f̶i̶g̶u̶r̶a̶t̶i̶o̶n̶ o̶r̶ t̶h̶e̶ r̶i̶g̶h̶t̶ v̶i̶d̶e̶o̶ ̶m̶o̶n̶i̶t̶o̶r̶.
With the help of VLSI tech support I had my facepalm moment for the week. Just from this picture they could tell me, that I had the crystal for PAL video mounted and not for NTSC (displeasure for some many different standards for everything). Fixing that and getting the video out termination right got me this result. YAY. Now it's only 1s and 0s and a lot of typing to program a graphics engine.
After some typing, compiling and syntax error fixing, this was the 1st response of the video chip on the shield:
Initially I was scratching my head about what was going on, because page 24 of the datasheet says, the default value for the ID register is ABh, but page 49 tells the correct value of 2Bh and everything is hunky-dory.
Now comes the easy part of figuring out how to configure the video display controller. The first image will be amazing as my only device with video input is a 40" TV.
2 boards are populated with all components (except the Arduino headers on one of them). One is build up with PAL crystal, the other with a NTSC version. Also only the PAL version has the additional video driver installed, it is just bridged on the other board. Initial test showed the 3.3V power rail OK and no smoke got released.
Things to note:
The KiCAD Arduino shield footprint has connector through holes that are very small for regular pin headers. I almost got a press-fit connection. The extra long female headers have thinner pins and are OK.
All other footprints that I grabbed from the KiCAD libraries turned out to be correct (maybe I was just lucky ;)
Testpoints are very helpful.
I like silkscreen that is large enough to read without microscope.
Now the programming begins, SPI communication first and then configuration of the video output. Then the fun starts with image display functions and porting Doom.
Finally the bare PCBs arrived from DirtyPCBs today. This time it took the full 8 weeks, which is OK. That is what they say with the slow shipping order. The quality is very good as usual. They even managed to put a solder dam between the pads of the 0.5mm QFP footprint. This will make hand soldering super simple. And they do panels if you put multiple designs on the board by yourself. They do nice thin slots and next time I will try mousebites for even easier separation. Now I am off to the soldering iron.
The little board is an in-line current source (* 78), which will be documented in its own Hackaday.io project.
"The Dot Factory is a small open source tool (MIT licensed) intended to generate the required C language information to store many fonts and images, as efficiently as possible, on a microcontroller."
How to generate an animation with the Block Move command (BoingBall)
I used a 8-frame GIF animation of the famous Amiga BoingBall and separately saved the frames with the help of IrfanView. With the same program the images got scaled that the ball had a size of 30 x 30 pixels with a 1 pixel border on all 4 sides making it a 32x32 image size.
On the website Image2ASCIIArt (A big thank you to Robert Ecker for this great tool) I converted the 8 single images to text files.
From here it was 3 simple search and replace operations and some surrounding code for a nice data structure that got used in my code to be programmed into FLASH similar to the character set. The code snipped below would look nice if it could be formatted to 32 entries per line.