09/21/2015 at 09:53 •
In preparation for the next round of judging, I recorded another brief clip demoing some of the features of VGATonic we've added (or, in the case of size, removed) since last round. Here it is:
For reference, the semifinals video is here:
Here's a text summary of the changes I've made since the first video was recorded.
- New Revision B, 40% Smaller
- ATTiny 4313A replacing 2313A for future features!
- External Oscillator, allowing 57,600 and 115,200 Baud modes
- (Alt Firmware) 848x480 VESA Standard Video Output
- Includes 424x240 mode as well
- Handles 70.7 MHz SPI, up from ~60 MHz for 640x480 firmware
- Updated Linux framebuffer drivers to allow widescreen flag to be set when loading kernel modules (see post)
- (Alt Firmware) NTSC in 320x240 in 16 Color Demo (Revision A)
- New Revision B, 40% Smaller
09/20/2015 at 02:53 •
I just flipped the switch on VGATonic from "In Progress" to "Completed" - I realized I hit every bullet point I wanted to hit when I first started this project (in 2014!) and I've added some awesome features along the way.
This, of course, doesn't mean I'm completely done with VGATonic - I've built up a small wishlist of things, but there are no showstoppers remaining. Here's what I've got:
- Add Driver Support for More Things!
- Will this ever really end? (Is a project really ever 'complete', philosophically?)
- Terminal Emulator Working in the Widescreen Firmware
- It is making a lot of assumptions internally, but it can be rewritten
- Widescreen wasn't even on my roadmap, but it's nice to have 848x480 and 424x240 now!
- 3-Bit and 6-Bit Color Palettes (See Below)
- I'll probably only put these into place for widescreen if I do them - they sacrifice a bit of color but gain frames per second without compromising too much.
Very Low Priority
- Terminal Emulator Working in the NTSC Firmware
- NTSC isn't very good on Rev A, but it works - I suppose this could be added.
Color Palettes - (Let Me Know if This Feature is Worth It!)
Here is an 8 bit color palette, roughly what VGATonic does today (we do true grays though):
Here is a 6 bit color palette, used on, for example, the Sega Master System:
And the other two...
Here is a 4 bit color palette, what VGATonic can do today in 4 bit mode:
Here is a 3 bit color palette, used on Teletext (and a lot of early computers)
- Add Driver Support for More Things!
09/20/2015 at 01:07 •
If you check Github, I just pushed the new drivers which support the widescreen version of VGATonic. To use them, when you load your board's VGATonic ko module, append "widescreen=1" to the end and the code will do the rest. (I put an example of loading it from scratch on the BeagleBone Black r3 at the end.)
I've been playing with it today as we approach the second deadline for the project - and I have to say, since 640x480 is usable, 848x480 is excellent and doesn't feel too cramped. There is also code in there for 424x240 which isn't that bad of a desktop either (screenshots below).
Of course, I'm typing this on a Retina Macbook Pro 15", so I'm a hypocrite - but judge for yourself, then go build a VGATonic! Compare these images to the others scattered on this project page.
OpenTTD in 848x480 on BeagleBone Black r3 - 14.25 Frames Per Second
Shot of 848x480 browsing the web... very serviceable!
Even 424x240 is relatively comfortable. 320x240 is *marginal* on the desktop, and the 32.5% extra pixels come in handy.
Example for the BeagleBone Black r3
(Similar for the other boards, just don't do the device tree stuff.)
As for starting from scratch, first grab the code off Github. Then navigate to the VGATonic_Linux_Drivers directory. Then:
echo BB-SPI0-01 > /sys/devices/bone_capemgr.*/slots make clean ; make sudo insmod vgatonic.ko # Next one is the key. # Make sure you have the widescreen firmware installed! # If you don't, omit widescreen sudo insmod bbb_r3_vgatonic_spi.ko widescreen=1 # SU to your user account so chromium will work! su <yourname> FRAMEBUFFER=/dev/fb1 startx
09/19/2015 at 20:32 •
Summary of the New Firmware
- A New Firmware with widescreen resolutions for VGATonic
- Can support Raspberry Pi 62.5 MHz SPI officially with this mode
- (Beware your connections - short and twisted wires work best)
- VESA Standard 848x480 @ 60 Hz Mode
- Also includes 424x240 (everything speeds up by 4)
- Pick either this firmware or 4:3 640x480 based firmware
New Firmware Improvement over 4:3 VGATonic Resolution 848x640 32.50% Max SPI Speed 70.7 MHz 18.30% Max FPS on Rpi 2 @ 8 Bpp 19.19 50.90%
Details of the New Firmware
Note I'm stress testing it in my Northern California un-air-conditioned sunroom - expect somehting to hit Github soon. For now, you can read about it.
I made some mentions in the project logs (and in the videos) of wanting to release a firmware version of VGATonic which could do 800x600 resolution - but while in the middle of writing some VHDL I realized - 4:3 monitors just aren't popular anymore! Every monitor (greater than 7") I've got here, in fact, has a 16:9 ratio.
So I did some Googling and I found something interesting - in 2003, VESA published a standard for 848x480 resolution at 60 Hz. Huh, today I learned - and yes your suspicion is correct - it's a bit of an outlier, since most new resolutions they have added have been larger than what was published.
It was my lucky day, too - I quickly coded up VHDL timings and realized that all 3 of my VGA screens will sync to it - it's just a "not very well known" resolution! (In fact, I think 720x480 or 864x486 was the most common early widescreen resolution due to NTSC DVDs - nowadays you're looking at 1280x720 or 720p being the most popular for TVs and entry level 16:9 monitors).
Being truly my lucky day, I did some math on the reduced blanking period possible in VESA's CVT standard, and we can do it with a 30 MHz pixel clock. We have one signal (memory write) which works at 4x our pixel clock with a 8ns hold time minimum, so we just squeeze by the spec - clocking in at 8.333 ns with this resolution.
That means I can officially support it in VGATonic instead of asking you to build it at your own risk due to the overclocking. All of the parts are still meeting their manufacturer specified timings - even with 32.5% more pixels!
The news gets better. Since the SPI speed supported on VGATonic is affected by the pixel clock, our roughly 5 MHz increase in pixel clock speed means VGATonic can now handle 70.7 MHz SPI (up from 59.8 MHz) - to be safe, call it 70 MHz. Either way, that means we've got headroom for that previously just-out-of-reach 62.5 MHz SPI on Raspberry Pi.
Here are the timings I'm using, so you can check your monitor would support it (Don't hook it up to most CRTs unless you are absolutely sure what you are doing, but most standard compliant widescreens manufactured after late 2003 should support it). Note that I'm using "Reduced Blanking" periods, which is why my CRT warnings are necessary.
Horizontal Frequency 29.76 kHz Vertical Frequency 60.25 Hz Pixel Clock 60 MHz Aspect Ratio 16:9 Hsync Polarity + Vsync Polarity - Horizontal Blanking Length 5.33333 us Horizontal Total Length 33.6 us Horizontal Front Porch 1.6 us Horizontal Sync 1.07 us Vertical Blanking Length .47 ms Vertical Total Length 16.598 ms Vertical “Front Porch” 0 us Vertical Sync 168 us
09/17/2015 at 04:27 •
Yesterday I told you I had NTSC working on a Rev A version of VGATonic. Today, I cleaned up the code a reasonable amount and posted it on Github.
Remember: only use it with a Rev A board, even though I happily announced a new-and-improved B the other day: that one has NTSC signals broken out, but you'll need to populate the connector on the rear side of the board and (here's the kicker) build a DAC. Rev A has all of that.
Also, remember it's locked at 320x240 in 16 colors with the firmware I posted, although the code has comments in the places you'd have to adjust to increase (or decrease) colors or resolution.
Finally, don't use SPI over 21.9 MHz.
If you build a Rev A and get NTSC working, let me know! Next up: I'll take a shot at an alternate firmware for 800x600, using that shiny new Rev B board.
09/16/2015 at 06:34 •
I'm happy to show a major milestone tonight; I got NTSC working on VGATonic's rev A board!
Call it NTSCTonic!
Here are the vitals:
- 320x240 'Fake' Progressive scan (as in not interlaced)
- 4 Bit Color
- (There are a lot more available for a future 256 color mode; I'll explain below)
- 21.977 MHz estimated top SPI Speed (so, 71 frames per second - capped at 60)
- Equation derived here, with a user clock of (17,896,845.40452/2) Hz
Getting NTSC To Work
It's in a messy state right now so I won't post the firmware that made it happen (watch for it soon!), but here's the rough sequence I took to getting NTSC working on VGATonic:
- Find a clock setting on the Linear LTC6903 which is a multiple of the NTSC colorburst frequency of 3.57954 MHz - OCT 14 DAC 100 gives us 17,896,845.40452 Hz, or a .005% error for 5x the NTSC clock
- Figure out which shades of colors I had. 360 degrees divided by 5 means 5 phases/colors, but since it is an odd number I can also INVERT those phases (shift them by 180) for 5 free phases. That leaves us with this:
Phase Degrees from Colorburst 0 36 72 108 144 180 216 252 288 324 Color Name Yellow Light Green Green Cyan Indigo Blue Purple Magenta Red Orange
- If you look at the schematic for the rev A board (linked nearby) you'll note I also have a number of outputs for "Luma", which controls brightness. For this firmware release, I wanted to easily match one of the VGA modes, and 16 color/4 bit allowed me to do that with limited colors and luma.
- A motivated builder could get up to 10 shades + Black/White Gray (11) and 16 shades of luma, or 176 colors by just changing the mapping. For more colors, you'll need a higher frequency for more phases.
- Also, note that the colors won't match VGA perfectly, so you'll have to come up with translations (these 16 are hard coded in VHDL and it fits easily in the CPLD).
- In practice, my colorburst frequency was .07% off - it works on my monitors, but seriously... if you do an NTSC project, use an oscillator with a magic frequency multiple of 3.57954 MHz instead of trying to do it like this!
I will post some code soon if you want to build it, then I will work on adding a higher resolution VGA option on the rev B board!
09/07/2015 at 08:02 •
As you probably suspected from the past two posts, Rev B is ready - VGATonic is roughly 40% smaller!
- External Microcontroller clock with magic serial frequency of 7.3728 MHz
- Allows 115200 Baud serial!
- Swapped Atmel ATTiny 4313 into 2313a spot (pin compatible)
- Better ground isolation for VGA output
- Partial shielding in SPI signal section
- Fixed swapped hardware SPI from uC to CPLD, no longer need workaround
- Added LEDs!
Unless you were planning on using VGATonic as a dev board (?) and are able to solder .5mm pitch parts but not .4mm pitch parts, please build Rev B. Rev B has an unpopulated .4mm pitch header compatible with Hirose DF40C-30DS-0.4V (81 cents, Digikey) if you want to play with those GPIOs.
- External Microcontroller clock with magic serial frequency of 7.3728 MHz
09/07/2015 at 07:25 •
Reference Value Footprint Cost / Board Supplier Quantity Required Notes IC1 ATTINY4313 Housings_SOIC:SOIC-20_7.5x12.8mm_Pitch1.27mm 1.59 Newark 1 C1 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C2 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C3 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C4 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C5 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C6 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C7 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C8 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C9 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C10 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C11 0.1uF Capacitors_SMD:C_0603 0.00359 Digikey 4000 X7R C12 1uF Capacitors_SMD:C_0603 0.1 Digikey 1 X7R U3 IS61LV5128AL Footprints:tsop2-44 4.85 Jameco 1 U1 LTC6903 Housings_SSOP:MSOP-8_3x3mm_Pitch0.65mm 3.92 Digikey 1 U2 XC95144PQ100-100TQFP Housings_QFP:TQFP-100_14x14mm_Pitch0.5mm 7.25 Digikey 1 R2 4.7k Resistors_SMD:R_0805 0.018 Digikey 10 5.00% R1 10k Resistors_SMD:R_0805 0.018 Digikey 10 5.00% R3 10k Resistors_SMD:R_0805 0.018 Digikey 10 5.00% R4 10k Resistors_SMD:R_0805 0.018 Digikey 10 5.00% FID1 CONN_01X01 Fiducials:Fiducial_1mm_Dia_2.54mm_Outer_CopperTop 0 5.00% FID2 CONN_01X01 Fiducials:Fiducial_1mm_Dia_2.54mm_Outer_CopperTop 0 5.00% R11 510 Resistors_SMD:R_0805 0.021 Digikey 10 1.00% R12 1k Resistors_SMD:R_0805 0.021 Digikey 10 1.00% R13 2k Resistors_SMD:R_0805 0.021 Digikey 10 1.00% R8 510 Resistors_SMD:R_0805 0.021 Digikey 10 1.00% R9 1k Resistors_SMD:R_0805 0.021 Digikey 10 1.00% R10 2k Resistors_SMD:R_0805 0.021 Digikey 10 1.00% R5 510 Resistors_SMD:R_0805 0.021 Digikey 10 1.00% R6 1k Resistors_SMD:R_0805 0.021 Digikey 10 1.00% R7 2k Resistors_SMD:R_0805 0.021 Digikey 10 1.00% F1 0.75A HOLD 6V PTC Resistors_SMD:R_1210 0.2544 Newark 10 U4 NCP1117ST33T3G Footprints:SOT223_PWR 0.49 Digikey 1 LDO Not Needed C14 10uF SMD_Packages:SMD-1206_Pol 0.4848 Newark 5 Tantalum, 6.3V C15 10uF SMD_Packages:SMD-1206_Pol 0.4848 Newark 5 Tantalum, 6.3V C13 47uF SMD_Packages:SMD-1206_Pol 0.0672 Newark 1 Tantalum, 6.3V P6 CONN_02X03 Pin_Headers:Pin_Header_Straight_2x03 0.06 J2 VGA-HD-15 Footprints:HD15_B-HD15F 1.18 Newark 1 Newark 54M6031 C16 22pF Capacitors_SMD:C_0603 0.024 Digikey 10 X7R C17 22pF Capacitors_SMD:C_0603 0.024 Digikey 10 X7R Y1 7.3728 MHz crystal:HC49_sm 0.325 eBay 20 MFG Not Important P1 CONN_01X03 Pin_Headers:Pin_Header_Straight_1x03 0.03 P2 CONN_01X05 Pin_Headers:Pin_Header_Straight_1x05 0.05 P3 CONN_01X02 Pin_Headers:Pin_Header_Straight_1x02 0.02 P4 CONN_02X03 Pin_Headers:Pin_Header_Straight_2x03 0.06 P7 CONN_01X30 Footprints:DF40C-30DS-0.4V Optional D1 Green LED LEDs:LED-0603 0.0495 Jameco You Pick Color R14 330 Ohm Resistors_SMD:R_0805 0.212 Digikey 5.00% R15 150 Ohm Resistors_SMD:R_0805 0.212 Digikey 5.00% R16 150 Ohm Resistors_SMD:R_0805 0.194 Digikey 5.00% D2 Yellow LED LEDs:LED-0603 0.0495 Jameco You Pick Color D3 Orange LED LEDs:LED-0603 0.0495 Jameco You Pick Color P5 USB_B Connect:USB_B 0.5528 Newark Newark 14N8154
Total cost before PCB service: $22.88 (plus shipping), not including optional DF40C-30DS-0.4V ($.81 at Digikey)
PCB Service at Elecrow: $1.10 (plus shipping)
Total estimated cost: $23.98 plus shipping
08/30/2015 at 17:21 •
I just built 2 boards from a new batch of VGATonics I sent to OshPark: this one is 39.1% smaller, roughly 5.5 square inches versus roughly 9 for the old one:
Sure, the RCA jack is gone on this version (but not forgotten - on the back side of the board there is a 32 pin .4mm pitch exposed area to add a Hirose connector if I want it and the other GPIOs), but I'll be experimenting a bit with the software on this version.
I put an Atmel ATTiny 4313a in place of the 2313a (they are pin compatible), and added an external 8 MHz crystal - my plan is to make the Asynchronous Serial a bit more robust and allow some more speeds. In the interest of signal integrity, I shielded 70% of the external SPI signal lengths on the board (although, of course, most of the SPI signal integrity problems I've seen were due to long, untwisted jumpers) and made 3 'separate' ground domains. Finally, I fixed the swapped MOSI/MISO on rev A which caused me to have to use software SPI to program the clock - it's all hardware SPI now from the ATTiny!
Minor details all, but it should add up to more stable VGA from this revision - along with some enhancements on the Asynchronous Serial side.
Also, my daughter really likes that I added LEDs - although I should have used something bigger than 0603s! (Orienting those things is painful). It took me about 4 hours to solder and get both boards working that you see above - bringing VGATonic's family size to 8 counting the 4 down in Pasadena!
I have it 'working', but with minor edits the old firmware - when I get the external crystal working with a few more serial speeds I'll post everything you need to build rev B. This will eliminate the optional calibration step from the build instructions when done. For now, if you build one, please build Rev A.
08/25/2015 at 06:09 •
Hey folks, I wanted to thank you all for the support - VGATonic is a Semifinalist in the 2015 Hackaday Prize contest!
I also entered into the Best Product category, but VGATonic was edged out by 10 very excellent entries - five of which are in the running for both prizes! Congratulations to you all and best of luck!
That means I've got to pivot the messaging for VGATonic from just a 'product'; how can I ensure that we're building something here that matters?
The best argument, I think, boils down to enabling people to get started quickly with graphics (I laid out a similar argument in my second project log from this year's prize). There just are not a lot of other graphics cards examples out there, and we've already got something solid here - 640x480 VGA on a number of Linux single board computers (and some microcontrollers as well). Throw in the basic 2D acceleration stuff, and we're head and shoulders above most graphics projects.
There's more than enough here to show something useful... and hopefully even impactful!
So, with that in mind, I'm planning on exploring lighting up that RCA jack with some NTSC video next as an optional firmware. (NTSCTonic?). Then, in a single project, you'll be able to get from 0 to VGA or from 0 to NTSC very quickly - and perhaps with a nudge we can add PAL as well, covering a wide range of "first generation" video technologies. (I don't know much about SECAM, but I think NTSC/PAL/VGA covers most of the world)
It would be great to present an < $25 BOM board which can do either NTSC or VGA, dealer's choice, right? And having the platform is nice... but hopefully I document it in a creative way so this becomes educational as well! With the modest sized CPLD on board, it might make a reasonable project for an introduction to VHDL, before folks move on to FPGAs (even most entry level ones are at least 5x the relative logic size of the 144 macrocell CPLD). But, please, if you have ideas - brainstorm with me!
Congratulations to the other semifinalists, and good luck!