Go Down

Topic: Error: Arduino Mega 2560 - VGA OUTPUT (Read 3 times) previous topic - next topic

Nick Gammon


Before I start could anyone confirm that the mega 1280 and 2560 are similar enough for it to be worth my while?


Yes, one just has more RAM etc. than the  other.

MarkT

Any thoughts on the Arduino Due and VGA?  Personally I've only used a Parallax Propeller for driving VGA, as it will drive larger screens happily (1024x768 as 64 lines of 128 characters in 8 bit colour for instance).  In fact I'd never really considered the Arduino for this, but with faster Arduinos this might become interesting...
[ I won't respond to messages, use the forum please ]

Nick Gammon

The timing was the critical thing. You just don't get the required time to draw a pixel in VGA on a 16 MHz processor.

The pixel time at a horizontal resolution of 800 is 39.68 nS. You can't do that with a processor with a clock of 62.5 nS.

But the Due? With a clock of 84 MHz that should give the edge to allow individual pixels to be drawn. I reckon the clock must be 11.904 nS so that means you have a couple (three?) clock cycles to get a pixel out.

I'll give it a try when I get my hands on one.

stimmer

#8
Nov 21, 2012, 12:37 am Last Edit: Nov 21, 2012, 12:38 am by stimmer Reason: 1
We've been lucky. Only minimal changes are needed to get the program to comple and run. The compilation error was caused by a missing #define which is easily fixed. Then it is a simple matter of changing the hsync and vsync pins as the mega has them mapped to different pins.

Simply change the code near the beginning to this:
Code: [Select]

#define UCPHA0 1
const byte pixelPin = 1;     // <------- Pixel data
const byte hSyncPin = 9;     // <------- HSYNC
const byte MSPIM_SCK = 4;    // <-- we aren't using it directly
const byte vSyncPin = 12;    // <------- VSYNC


hsync is now on pin 9, vsync is on pin 12. I have not been able to test I2C yet. (Incidentally, MSPIM_SCK isn't connected to an external pin on the Mega - this does not affect the functioning of the code.)

derdem2

Hi,
the kompiling works now. THX

If i am at home i will try it on my Arduino. When it works it would by nice ^^

thx for helping ;)

-David

Go Up