I use the C SDK and decided to create my own VGA driver for it.
I tried the VGA examples from GitHub (from pico-playground project) but none works for me... The VGA Monitor doesn't lock on sync signals and reading the code makes me think it isn't standard VGA compatible. I looked into the their demo videos and it sounds like they are using old CRT VGA monitors that may support out of specs VGA signals.
Anyway, I successfully made my Pico generate VGA 640x480 60Hz correctly. So far, it produces 256x240 pixels with 256 colors (8bpp).
I decided to port Adafruit GFX to the Pico and use both cores. I don't use PIO for the VGA driver, but instead, a plain Bitbang
![Laughing :lol:](./images/smilies/icon_lol.gif)
So I also decided to make one core deal with the VGA driver while the second core draws to the VGA RAM Video buffer.
I coded the demo based on CBM80Amiga work on the Pico, but instead of TFT, it drives the VGA --> https://www.youtube.com/watch?v=YLf2WXjunyg
Pico is Fast! I managed to draw the most complex 3D object in the demo in just 14 ms.... running Pico at 125MHz
What I had to do in order to make it work:
1- It used both Cores as said. Each core has its own NVIC, thus I could make a specific Core to handle timing IRQs.
2- I used PWM functionality to drive IRQ at certain time frame for VGA, as well as, to generate HSync signal correctly - this is a crucial point for VGA signal.
3- I bitbang the pixels on the screen with a single for(;;), which produces almost equally sized pixels - it was impressive. Pico has a Flash Cache acceleration very similar to STM32 ART, seen on STM32F4 upwards series. But I run IRQ routine from SRAM for better performance.
4- In the first test the VGA frames have a lot of jitter. I had to use a double screen frame buffer in order to draw more complex 3D objects because it takes the whole time of a VGA Frame (16.6ms). Because of it, with a single VGA frame buffer, while it was drawing the 3D objects in the buffer, it was at the same time sending the scanlines to the VGA monitor - a race visible in the screen. But even using double buffer there was jittery - thus I had to set a register in order to make Core 1 to have a higher AHB access priority. By doing it jitter is gone. Core 1 sends pixels to the VGA monitor and it was racing access to SRAM with core 0, causing the jitter. Now the image is crystal clear.
5- Core 0 draws in the not used frame buffer and its both cores work in sync using semaphores, similar to a multitasking OS.
I liked the dual core stuff!
The next step will be to make the scanline to be sent using PIO and DMA.