Uses the RP2040's Programmable IO to create a PAL colour video signal. It consists of the PIO program, some "driver" and tools code, a test program and a program for creating colour Look-up Tables (LUTs).
A schematic for the R-2R-DAC I use is included as well as a spread sheet I used to play around with colours to get a feeling. Source code files:
PAL3.pio: assembly code for RP2040 PIO to generate a PAL signal. analogVideoDriver.c/.h: driver and some helper code for rendering pixels onto a TV using a PAL signal. paltest.c: sample application which shows how the driver code is used. PAL_LUT_64_4b.h: a look-up table generated by pal_colour_table_gen, defines 64 colours (each component, red, green, and blue, has two bit resolution) for a 4-bit DAC. pal_colour_table_gen.c: a helper application which generates colour lookup tables. Has to be compiled manually as of now: gcc -lm -o pal_colour_table_gen
To compile the code, first clone this repository: git clone https://codeberg.org/chipfire/rppico-pio-pal.git
Next, download the RP2040 SDK (follow instructions in the getting started PDF, https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf).
Then create the build directory (this will avoid messing up the code directory) inside the cloned repository and change to it: mkdir build cd build
Make sure you have set the environment variable PICO_SDK_PATH and call CMake: cmake ..
If you run into trouble, pass it the PICO_SDK_PATH variable (I always had to do this, something's messed up): cmake -DPICO_SDK_PATH=/path/to/pico/sdk ..
Now all you have to do is call Make: make
That should be all. Ah, the DAC has to be connected to GPIOs 0-3 unless you change that in paltest.c