Hello I am thinking of giving myself a challenge and making a small pong type console using a cerb 40 board that I have spare. I want to do this for the lowest cost possible and so I was thinking of doing the VGA code and wiring myself.
From what I can tell I need to be able to clock at about 25mhz to update the VGA sync and output the columns and rows correctly. Memory shouldnt be an issue as the main background will be green (no memory there) and there will be some basic rectangles to make up the pong scenery which I can calculate at runtime.
My concern is that the although I have the clock speed on the cerb would It will struggle to be consistent? Would RLP code be reliable enough to ensure a smooth output at 25Mhz?
Also does anyone know what will happen if I dont manage to get a fast enough speed? I cant work out if its defined by the VSync, HSync toggles or wether the tv has an internal refresh clock
Cool, so I wont get issues with the clock in netmf stuttering on other tasks?
Yeah memory isnt an issue as I will only have rectangles to draw and I can calculate these on the fly as I update the screen. You need memory with most displays because you keep an internal bitmap in memory, a snapshot of what you want to appear on the screen. I wont be doing this, if it falls mathmatically in a rectangle zone it will be coloured, if not then it will set the pixel to green as the background.
Of course you will and so you will need to have (in native code) a high priority timer interrupt that runs no matter what and handle the pins. NETMF will be the side task but the main task will be to handle timing.
@ Bodward - Standard VGA refresh non interlaced is 60hz to get a decent rendering you will need to refresh the screen at say 30 FPS but you could get away with 15 but it will look slow. Also based on the memory constraints you will probably only get away with 320x240 at best.
Good luck with the challenge though, its a nice project and i can’t wait to see how you get on
They run at 28MHz, but only do 240 x 224 pixels, getting 6 instructions per pixel.
At 25MHz pixel clock, and running at 150MHz you will also get 6 instructions per pixel. So it should be doable, but will have to be done in pure assembly.
You might have to change the CPU speed on the Cerb to 151.05MHz to get a pixel clock of 25.175MHz, but this might break NETMF…
Also note that the uzebox only has time to run game code during the Vsync time. The rest of the time is dedicated to placing the frame on the screen…
I also found a problem with Analog output pins. I dont have enough, the VGA RGB pins are 0 - 0.7v. This defines how bright each color appears. Without enough AOut pins I cant control all 3 accurately enough.
With it being only Pong I am considering only using 5 colors which means I could design a circuit so that its either 0v or 0.7v on each pin (no inbetween values) but I dont know what resistor to use as I dont know the current required by the pins and I think it will vary based on the screen you are plugged into. Its amazing how complicated something so simple can be lol.
I also considered using the DL40 but then you get the memory issue, the DL40 would need some way to store the graphics data so that it knows what to draw and your back to square one
Don’t use analog outs - use multiple digital outputs per color, one common scheme for instance is 8-bit color as RRRGGGBB (three bits for red and green, two bits for blue). Then choose resistors doubling in value to connect to your eight digital outputs in parallel so that the pins representing the most significant bits are connected to the smallest resistors and the least significant to the biggest resistors, so that you end up with 000 = 0V and 111 = 0.7v.
If I dont know the current draw then I wont know what resistors are required though will I? If the monitor changes and has a different draw then I will end up damaging the device
Sorry I am fairly new to hardware side of electronics. Normally use breakout boards whcih are all configured
@ Bodwad -
You have no much memory issue if you go specific for paddle game because you just store position of two big square, a ball, some other objects like points. You can receive via daisylink the position for the paddle pong. than you create right waveform syncs and an RGB323 signal with resistor ladders as suggested by RorschachUKSenior
You can’t make a VGA 640x480 bitmapped device, that’s sure.
Just to help a little to link the hardware, you can go as showed in the image. I used 2bit color (i think it’s enough) but you con go 3bit color adding a 1K resistor and 1 more bit res for RED and BLUE. Yellow label on the left are GPIO port from an MCU
Ooo thats a very nice diagram thanks. I might stick to very basic Red, Green, Blue, Black and White.
The bats will be red and blue, the ball and court lines will be white and the background will be green. Black is spare :P. That might keep it simple enough to test the idea before expanding it
@ Bodwad - Are you engaging the fight with this VGA idea ?
I’m interested in writing a small lib for a Cortex-M0 (like DL40) chip to output text and very basic low res graph to the display. You can consider also a composite PAL output instead of VGA, just to start.
If I can, tomorrow I will try to study something about that …
I will give it a shot as soon as I get some free time. Had a very busy weekend so not had anytime to sit down and even hammer out some basics. Also need to learn to start on RLP coding so its probably going to be a while.