VGA on Cerb challenge, do you think its possible?

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

It is basically one of these https://www.google.co.uk/search?q=TV+sports+pong&hl=en&safe=off&source=lnms&tbm=isch&sa=X&ei=hXZdUay6Dc3ZPNTvgOAD&ved=0CAcQ_AUoAQ&biw=983&bih=496#imgrc=nxGAZgcXcMppqM%3A%3BDlTPPM8tup-12M%3Bhttp%253A%252F%252Fwww.pong-picture-page.de%252Fcatalog%252Fimages%252FLloyds%252520TV%252520Sports%252520E-813%252520Color%2525204%252520Player_www.JPG%3Bhttp%253A%252F%252Fwww.pong-picture-page.de%252Fcatalog%252Findex.php%253Fmanufacturers_id%253D83%3B622%3B448

Thanks

Paul

Yes it can be done! You do not have enough RAM to host full images but you can draw this on-the-fly, juts like parallax propeller does

So does this 8bit AVR project

Is it easy? No it is not but your title has the word “challenge” in it :slight_smile:

2 Likes

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.

This is of course theory lol

Thanks for the replies :o)

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.

I best start learning the native stuff then lol.

Thanks for all your help, I will hopefully have something to show one day :slight_smile:

@ 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 :slight_smile:

Ok thanks Hugh, I will see what I can get from the board, its certainly going to be a challenge lol

This is an interesting application for a dl40 m0 chip… It can be used to create tv sync waveforms with specific firmware

I read some of the Uzebox’s docs. Look at http://uzebox.org/files/wiki/uzebox_how_it_works_v10.pdf

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…

lol sounding very scary now.

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 :stuck_out_tongue:

Hope that makes some sense lol

Paul

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.

1 Like

Oh cool would never have thought of that.

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 :frowning:

Sorry I am fairly new to hardware side of electronics. Normally use breakout boards whcih are all configured :stuck_out_tongue:

Paul

Just use the same values as in this post about VGA on Arduino Due - the Due is a 3.3v device same as the Cerb so should work fine.

@ 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.

Oh cool thanks, that will be very useful :smiley:

I will let you all know how it goes, Going to try and use just the cerb first and then try the Dl40 if I cant get it working correctly :o)

Paul

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

1 Like

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 :slight_smile:

Paul

@ 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.

Feel free to have a go yourself :o)

@ dobova - Aahh no I’m not in a hurry … I’ve lot of thing on the to do list this month. I was just curious if are going to do that project.