I should be doing something else, so I've decided to get SCART / 15KHz RGB output working.
In theory, this is quite simple, as all the machinery for 15KHz video is already there for the PAL/NTSC composite output stuff. While I have my head in this bucket, I've also take a moment to look at the remaining NTSC colour space bugs.
Generating the SCART 15KHz video signal is in theory very simple:
composite_sync <= not cv_sync;
if rising_edge(clock27) then
-- SCART 15KHz video is embarrassingly easy, given that we generate all
-- the composite signals already.
composite_red <= cv_red;
composite_green <= cv_green;
composite_blue <= cv_blue;
-- (composite_sync is assigned continuously unclocked just above, since it is
-- generated in 81MHz clock domain).
Then at the top level, I have DIP switch 4 (i.e., the 5th DIP switch) set to select whether this gets used to drive the VGA port or not:
led <= scart_mode;
if scart_mode = '0' then
hsync <= up_vga_hsync;
vsync <= up_vsync;
vgared <= up_red;
vgagreen <= up_green;
vgablue <= up_blue;
else
hsync <= composite_sync;
vsync <= composite_sync;
vgared <= composite_red;
vgagreen <= composite_green;
vgablue <= composite_blue;
end if;
The only problem right now, is that it doesn't matter what I do to the DIP switch, I'm still seeing 31KHz video (checked with multi-meter). On the plus side, the SCART monitor shoulds a doubled image, so the cable and RGB connections are all good.
That's why I've also wired the LED to the scart_mode signal. And I can't make it change. But I can read the DIP switch via $D69D. So where is it going west?
I'll try forcing scart_mode to always = 1, and see if that changes video refresh to 15KHz. That requires another synthesis run.
In the meantime, let's see if I fixed the NTSC bugs. For that, I pasted the whole VHDL file in to ChatGPT and asked why the NTSC colour was messed up. It found a bad copy-pasta problem, where I still had a PAL value in the chain somewhere. And it also told me to rotate the colour space correctly. Let's see if it works. I just need to find where on earth I put the composite cable I made up... Found.
NTSC colours are still messed up: Red becomes blue, and purple becomes green. Debugging that at the moment with some suggestions from ChatGPT to work out if I have U and/or V signs and or rotation wrong.
Meanwhile, that synthesis with the SCART mode flag changes still hasn't had any effect. I've confirmed that I can toggle the LED on the board, though. So if the SCART mode flag still refuses to switch, I'll tie it to the signal that does control that LED. I'm starting to suspect that a Vivado partial resynthesis might be to blame.
Yes, with a make clean first, Vivado even reports synth errors. How on earth it could justify not parsing those source files while deciding whether to do a partial synthesis or not, I have no idea. Now actually synthesising...
Okay, so now SCART output works. The NTSC composite fixes are still not right, but that might be because of commits not on the branch I'm working on.
So I'm going to leave it at that for now with SCART working, and get back to what I should have been doing today.