Pages: 1 [2] 3 4 5   Go Down
Author Topic: VGA library - now with TV output  (Read 27542 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
Logged


Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-cool 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!)


* GPS.jpg (159.49 KB, 1280x960 - viewed 164 times.)
« Last Edit: April 21, 2013, 05:21:24 pm by stimmer » Logged


US
Offline Offline
Full Member
***
Karma: 4
Posts: 183
Electronics are the new Legos
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Stimmer,
  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.
« Last Edit: May 02, 2013, 10:08:32 pm by BKnight760 » Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged


0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Stimmer,

VGA Library:
stimmer-DueVGA-0.404-3-g86f6dc0

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:
SdFatBeta20130207
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Stimmer,
   Thanks for the advice.  Switched to

#define USE_SAM3X_DMAC 0

in the SDFat library, and everything works perfectly now.
Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


0
Offline Offline
Edison Member
*
Karma: 67
Posts: 1655
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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() {
  VGA.begin(320,240,VGA_COLOUR);
  sd.begin(chipSelect, SPI_FULL_SPEED);
  file.open("anim.dat", O_READ);
}

void loop() {
  file.rewind();
  while(file.available()){
    file.read(VGA.cb,320*240);
  }
}
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!)


* shot0001.png (903.31 KB, 640x480 - viewed 169 times.)
* duevgaanim.mp4 (3003.17 KB - downloaded 84 times.)
« Last Edit: May 08, 2013, 09:24:50 pm by stimmer » Logged


Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.



* waterfall.jpg (148.04 KB, 800x622 - viewed 82 times.)
Logged


Pages: 1 [2] 3 4 5   Go Up
Jump to: