Go Down

Topic: VGA library - now with TV output (Read 65859 times) previous topic - next topic


First of all, really great work!

I tried the DrawingTestPal example of your library with the Arduino Ide 1.5.2 on my Arduino Due, but it show me this error :

Code: [Select]

In file included from DrawingTestPAL.ino:1:
C:\Users\andrea\Desktop\Andrea\Arduino\arduino-1.5.2\libraries\VGA/VGA.h: In function 'void _v_digitalWriteDirect(int, boolean)':
C:\Users\andrea\Desktop\Andrea\Arduino\arduino-1.5.2\libraries\VGA/VGA.h:49: error: 'g_APinDescription' was not declared in this scope
C:\Users\andrea\Desktop\Andrea\Arduino\arduino-1.5.2\libraries\VGA/VGA.h:50: error: 'g_APinDescription' was not declared in this scope

Make sure you have selected Arduino Due in the Tools/Board menu - that's the main cause of that particular error message.
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html


Make sure you have selected Arduino Due in the Tools/Board menu - that's the main cause of that particular error message.

It works!

Thank you!


Apr 22, 2013, 12:19 am Last Edit: Apr 22, 2013, 12:21 am by stimmer Reason: 1
Quick preview of the next release: Only minor bugfixes in the library, although one of those bugs was causing a hang when receiving Serial data, so if you use Serial and VGA you should upgrade (the fix is already in github master if you need it now)

The major addition is a new demo, which decodes GPS GPGGA/GPGSV strings and shows a rotated globe and satellite positions. Data can be taken from a real GPS or entered in the serial monitor. You have probably seen smartphone apps which do this, well now you can do it on an Arduino too 8) Watch satellites move across the sky in real time (although only if you are very patient as it takes the satellites 6 hours to get from one side of their orbit to the other!)
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html


Sparkfun has a VGA breakout introduced lately, can this make connections for Due users easier?  https://www.sparkfun.com/products/11569


Yes you could use that although it is actually 6 bit, not 8, so in colour mode you would only get 64 colours (you might be able to get all 256 by adding a few extra resistors). Mono mode should be just fine. It would need a bit of work to wire it to the right pins - it wouldn't just be able to plug straight into the Due like it can with a Papilio.
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html


May 03, 2013, 05:03 am Last Edit: May 03, 2013, 05:08 am by BKnight760 Reason: 1
 I downloaded the library, but running into issues when also using the SDFat library to read my graphics off the SD Card.  Any thoughts why these libraries conflict?  Is there any potential for making them able to work together?  It was possible previously with the PWM version.

 I'd really like to use the VGA library because it's so convienient, but reading the graphics data off the SD card is absolutely needed (ie: I can't load the bitmap into the VGA library framebuffer without the SDFat library being initialized at the same time).  I was hoping to take advantage of the speed increases you mentioned before, as well as the image stabilization using the additional timer.

Thanks for any info you can provide.


If it worked before I'd say there's a good chance that it will work again. I'll take a look at it later today.

Could you tell me a few things: which VGA screen mode are you using (mono, colour, PAL or NTSC), and which exact version of the SDFat library are you using and how is it wired up?
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html



VGA Library:

Color at 320x240

Adruino Pin
34, 35 --> Blue
36, 37, 38 --> Red
39, 40, 41 --> Green
42, 43 -->  Hsync / Vsync

I'm using the Arduino Wifi Shield (R2) with onboard SD Card reader.  I'm not actually using the Wifi functions at the moment.

SDFat Library:


Thanks - could you please try the following as a temporary workaround.

In the SdFat library, in file Sd2Card.cpp on line 85:
change "#define USE_SAM3X_DMAC 1" to "#define USE_SAM3X_DMAC 0"

Tell me if it works, and if it does work is the SdFat library now too slow or at an acceptable speed?

It looks like there is a DMA clash between the VGA and SdFat libraries. It should be possible to sort it out properly somehow - there should be a way to use DMA for both at the same time.
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html


   Thanks for the advice.  Switched to

#define USE_SAM3X_DMAC 0

in the SDFat library, and everything works perfectly now.


Thanks for letting me know. I think I have found out what the actual problem is (basically in DMA mode SdFat gets SPI overruns if anything else is using DMA at the same time) but I'll bring it up in the SdFat thread where fat16lib is more likely to see it.
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html


OK, after a lot of testing and debugging it turns out that using the #define USE_SAM3X_DMAC 0 workaround posted above is the fastest and best solution I can find to the problem of running DueVGA and SdFat together.
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html


Does running SdFat at a slower SPI speed like this work?

Code: [Select]
  if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();


May 09, 2013, 02:12 am Last Edit: May 09, 2013, 04:24 am by stimmer Reason: 1
No, even at SPI_SIXTEENTH_SPEED they still wouldn't work together in DMA mode.

I'm happy with the speed in non-DMA mode. It's fast enough for uncompressed full-screen animation at about 15fps. The code just loads each frame directly into the colour buffer:
Code: [Select]
#include <VGA.h>
#include <SdFat.h>

const int chipSelect = SS; // you may need to change this to the pin you connected SS to

SdFat sd;
SdFile file;

void setup() {
  sd.begin(chipSelect, SPI_FULL_SPEED);
  file.open("anim.dat", O_READ);

void loop() {

I've attached a video of the output (though being a highly compressed shaky video of a shaky video it doesn't look as good as it does in real life!)
Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html


I've made a new release of the library. Get it here: DueVGA-0.512.zip This release fixes a few bugs and clashes between DueVGA and the Serial and Audio libraries.

It also includes three longer demos - the GPS demo and the Animation demos have been posted above already, the other one is a demo of a waterfall plot. This takes an audio signal as inout, samples it and performs a FFT, and shows the result on a scrolling display. See the video and screenshot below for an example of what it does.

Due VGA library - http://arduino.cc/forum/index.php/topic,150517.0.html

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131