Working on a Composite/VGA VideoSynth for the RP2040 (guidance?)

Hi great comunity!
It’s been a few years since I started working on this Composite/VGA video synth which I plan to make open source. But I hit a blocking road.

SMALL VIDEO DEMO: https://youtube.com/shorts/ao-Zw99gN0Q

It has a layer system in which each layer has different patterns which draws different sprites
I think it looks promising, it’s made with a RP2040 for the cheap price.
It has USB Midi, an LCD screen all working perfectly.
It also uses a AD724 for NTSC/PAL composite output which requires INTERLACED VGA OUTPUT!
And here lies my problem

I was using Arduino/platformIO with this VGA library:
https://vanhunteradams.com/Pico/VGA/VGA.html
Which works great but it only has NON-INTERLACED VGA OUTPUT, so it doesn’t works with AD724.

So after a lot of work I could implement this library:

And got it working in tandem with the AD724! I could produce rectangles, shapes and such.
The only problem is that, with that new library, if the RP2040 is working hard, which is my case, it produces glitches in the image, which you can see in my video demo.

I’m now stuck, don’t know where to go. I’m not an expert in programming DMA, but with the help of chatgpt (I know, sorry jajaja) I tried to change Hunter Adam’s library to display interlaced output, got stuck. And also tried Hunter Adam’s library way of work with the pico-mposite library and couldn’t make it work.
There something about Hunter Adam’s library that doesn’t make it glitch even at extreme processing that pico-mposite doesn’t has.

Anyone could guide me in what to do or try?? Thanks a lot!! :slight_smile:

6 Likes

sounds like a cool project ! i hope you find a way to continue progressing - i know what its like to hit road blocks like that and to feel out of depth trying to understand the innards of micro controller libraries…

i also have been using rp2040s for video sync generation in a few projects lately. and have had some success working with the ad724. in my case the rp2040 is outputting composite csync to the ad724.i think (like you have maybe discovered also ?) this is a better route since the vga mode required to work with the encoder is quite specific and unusual…

im not too familiar with either of the libraries you mention. one suggestion if you just need to push more performance out of your pico is to try overclocking it. often these can safely run quite a bit faster than offically labelled… you may need to pick a clock value that divides to the the same clocks for the PIOs and or make sure its a multiple of 12mhz if using usb…

another suggestion if you still need more ‘power’ out of your micro is to try porting your project to the newer rp2350 - they are still quite cheap and should be able to give you a bit more performance if thats the main bottleneck…


if neither of those work and you are set on porting the VGA library to interlaced sync, i would suggest starting by trying to find a computer or device or something that can generate the “interlaced RGB video and clock rates that are consistent with those required by the television standards - interlaced output at 60 Hz (50 Hz for PAL))”

confirm that it does work with your ad724 setup, and carefully take note with a scope what the hsync and vsync timings are and how they are arranged. (from a quick google it sounds like the second field needs a half line offset on vsync pulse or something ?)

then once you know what you are looking for, take a look into the PIO code that generates the sync timings and think about how it can be modified…

happy to chat more and help out with this where i can

3 Likes

Thanks for your time adn effort, cyberboy!
I have your r_e_c_u_r and used it many times live :smiley:

in my case the rp2040 is outputting composite csync to the ad724

Were you able to generate a stable image? Would you share your code with me?
I am using Arduino/PlatformIO with VSCode.

I’m not familiar with VGA timings and such, from a fast search I see that Csync its Hsync and Vsync combined.

My guess it’s that Hsync or Vsync (or both) get delayed when CPU is very bussy and that distorts the image and color.

try overclocking it

Already using 250MHz :slight_smile:

try porting your project to the newer rp2350

Will try that!

confirm that it does work with your ad724 setup, and carefully take note with a scope what the hsync and vsync timings are and how they are arranged. (from a quick google it sounds like the second field needs a half line offset on vsync pulse or something ?)
then once you know what you are looking for, take a look into the PIO code that generates the sync timings and think about how it can be modified…

Sounds like a good idea, but I don’t have any VGA device.

Anyhow my main goal is to output composite PAL and NTSC I think that would be the most useful feature for the user of a video synth, wouldn’t you think?
Since RP2040 can’t generate color composite video directly (as far as I know), I am using AD724 to do it.

1 Like

since your main goal is generating composite output i agree that generating csync in pal/ntsc timings makes most sense. and ya ad724 is a good approach for generating colour composite video (they are not cheap ics but hopefully available for a wee while longer atleast… )

i can share my sync gen code shortly - theres still one small issue with it i need to fix but i have an idea of how to - it only generates csync and blanking tho - none of the actual video signals so not sure how useful/performant it will be in your case.

im not doing any DMA stuff. one core of the rp2040 is just looping around the defined timings and adding to PIO queue, where the PIO sets the pin high low in correct timing…

so should have the whole other core free for graphic stuff and other PIO block if needed…

Maybe you should check this library:

I think it works just as you described, it uses an array to throw values for Vsync.
This is the library that most works for me, but has this problem that glitches out the screen when the CPU is burdened.

1 Like