RGB pattern generator circuit

Tool suggestions, soldering tips, general useful electronics knowhow.
Post Reply
User avatar
sandord
Posts: 673
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

RGB pattern generator circuit

Post by sandord »

I've built an ATtiny2313 based RGB pattern generator by following this guide: https://dselec.wordpress.com/generator.

The generator is designed to produce test patterns like these:

Untitled.png
Untitled.png (342.64 KiB) Viewed 3798 times

I'm intending to use it to be able to more accurately adjust my CRT monitors. The service manual has some internal calibration instructions that make use of a pattern generator so I figured this would help me.

Here's a picture of the finished build (I couldn't find a 90 degree connector however so I used a straight one).

Untitled.jpg
Untitled.jpg (84.44 KiB) Viewed 3820 times

Sadly, it doesn't work for my Commodore 1084S-P1 monitor, the picture keeps running vertically and also the horizontal sync is off. I've tried another of my monitors, with similar results. Please note that while the pictures all seem to have a blue shade, in reality I'm seeing different colors (it's my smartphone's camera that messing up).

c885a0c0-720f-4802-86ec-fd5ffb544255.jpg
c885a0c0-720f-4802-86ec-fd5ffb544255.jpg (70.41 KiB) Viewed 3820 times

Here's another one, I selected pattern 11 I think but I have no idea how each pattern is supposed to look exactly. The example pictures from the site don't mention the corresponding pattern numbers.

Untitled2.jpg
Untitled2.jpg (109.86 KiB) Viewed 3795 times

The project is like 10 years old and the author hasn't responded to the article's replies so I needed to look elsewhere for a solution.

So I hooked up my scope and measured the horizontal sync and I got 14,881.9 Hz. As the monitor's service manual indicates, the horizontal frequency should be "15,625 Hz (+600 Hz)". Does that mean that the tolerance is 600 Hz but only above and not below the 15,625? Or perhaps -300Hz and +300 Hz?

Anyway, 14.881.9 Hz is obviously too low, even when taking an optimistic 15.625 Hz - 600 Hz = 15.025 Hz as the lower limit.

As some of the replies suggested, the crystal oscillator should be 21 Mhz instead of the 20MHz as listed in schematics. When calculating the resulting frequency, we get (20,000,000 / 14881.9) * 15625 = ~20,998,662.81 so that's very close to the mentioned 21 MHz.

The problem is however, that I haven't been able to find any 21 Mhz crystals online. But I managed to get my hands on a few 21.3 Mhz crystals. I figured those would work as well because a 21.3 Mhz crystal results in a 15,851 Hz horizontal frequency. That should be well within the specified tolerance (a conservative 15,625 + 300 = 15,925).

So I replaced the 20.0 Mhz crystal with a 21.3 Mhz one. The scope confirms the horizontal frequency of 15,851 Hz:

DS1Z_QuickPrint1.png
DS1Z_QuickPrint1.png (42.16 KiB) Viewed 3820 times

Sadly, the problem didn't go away: the picture keeps running both vertically and horizontally.

I've also closely inspected the firmware source code and I can't seem to correlate the sync frequency with the crystal purely based on the source. Timer0 is set to a prescale of 8 and the counter is set to 96 so that should result in a rate of (21.000.000 / 8) / 96 = 27,343.75 Hz but that doesn't seem to correspond with the sync frequency I'm seeing on my scope.

Here's an excerpt from the source code (written in Bascom, see https://www.mcselec.com/index.php?optio ... Itemid=103). I've added my own comments, reflecting my interpretation of the logic.

Code: Select all

On Timer0 Frame : Enable Interrupts
Config Timer0 = Timer , Prescale = 8

Const Black = 8                         ' Sync pin up (bit 3), RGB pins down (bits 0-2).

' The timer function.
Frame:
    Timer0 = &H60                       ' Reset the timer counter.
    Video = 0                           ' Pulls sync pin down.

Vert:
    Incr Linecount

    ldi R17, $21                        ' Delay to generate a horizontal sync pulse.
Frame_delay:
    dec R17
    brne frame_delay
    nop

    If Linecount > 307 And Linecount <= 312 Then
        Goto Vert                       ' Extend the pulse length, upgrading it to a vertical sync pulse.
    Elseif Linecount = 313 Then
        Linecount = 1
    End If

    Video = Black                       ' Pulls sync pin up. Ends the sync pulse.
    Return
But since the scope reading confirms that the frequency looks okay, I don't think I need to change anything to the firmware at the moment.

Do you guys have any knowledge of sync tolerances? Do I really need to keep looking for a 21 Mhz crystal or should it work with the 21.3 MHz crystal as well?

Besides, I'm not completely sure the distorted picture is exactly what you'd expect of a simple out-of-sync picture.
User avatar
sandord
Posts: 673
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

Re: RGB pattern generator circuit

Post by sandord »

I'm currently debugging my SCART<->RGB-cable because I think I might have a mistake in the wiring! I suspect that the csync signal is missing and that would explain the weird picture!
User avatar
sandord
Posts: 673
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

Re: RGB pattern generator circuit

Post by sandord »

That was it! Silly me, always check your cables :headbang: :roll:

Untitled3.jpg
Untitled3.jpg (55.53 KiB) Viewed 3782 times

It has been an entertaining exercise to write this post anyway :lol:
User avatar
exxos
Site Admin
Site Admin
Posts: 23496
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: RGB pattern generator circuit

Post by exxos »

Great stuff! :dualthumbup:
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
sandord
Posts: 673
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

Re: RGB pattern generator circuit

Post by sandord »

By the way, I still have two unpopulated PCBs and a few 21.3 Mhz crystals laying around. If anyone is interested in building this circuit, I can mail a PCB and a crystal for P&P only. The other parts should be fairly easy to come by.
User avatar
sandord
Posts: 673
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

Re: RGB pattern generator circuit

Post by sandord »

I still have one PCB left.
User avatar
sandord
Posts: 673
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

Re: RGB pattern generator circuit

Post by sandord »

I'd love to build an enhanced version one day:

- no SCART but 9 pin DIN (purely aimed at 15 KHz RGB monitors)
- no SCART means no more 12V required so the power regulator can go as well
- enhanced patterns (does anyone have a good source for official pattern generator specs?)
- 'official' TV test channel image (see picture below)
- shades and gradients (current version is only 1 bit per primary color)
- overscan disable switch to reproduce ST screen area
- 50/60 Hz switch

I'll probably need a more powerful micro controller because of the shades and bitmap support (for the TV test picture, which I think is a bit too complicated to render using sync coding). I'm receiving a couple of Pi Picos in the coming weeks and I have seen VGA projects done with them so that sounds pretty promising. They're really cheap by the way.

test.jpg
test.jpg (22.33 KiB) Viewed 3688 times
User avatar
mrbombermillzy
Posts: 1441
Joined: Sun Jun 03, 2018 7:37 pm

Re: RGB pattern generator circuit

Post by mrbombermillzy »

Yep the old CSYNC vs H + V SYNC chestnut...

Glad you got it sorted.

Eventually I will need one of these devices when servicing my old Mitsubishi Megaview 37 and Aydin Ranger CRTs.
User avatar
sandord
Posts: 673
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

Re: RGB pattern generator circuit

Post by sandord »

mrbombermillzy wrote: Fri Jan 29, 2021 7:44 pm Yep the old CSYNC vs H + V SYNC chestnut...

Glad you got it sorted.

Eventually I will need one of these devices when servicing my old Mitsubishi Megaview 37 and Aydin Ranger CRTs.
Yeah, so many pins available and still they didn't provide separate H/V sync pins.
User avatar
sandord
Posts: 673
Joined: Mon Aug 13, 2018 10:08 pm
Location: The Netherlands
Contact:

Re: RGB pattern generator circuit

Post by sandord »

I'm doing some test pattern research, trying to figure out what patterns the adjustment instructions from my monitor's service manual (Commodore 1084S-P1, Atari SC1435) is referring to:

- Purity
- White frame
- Color bars
- DEM pattern

The first three are fairly obvious but I can't find any example of what a DEM pattern looks like. All I can find is the following description:
Demodulator is a combined test pattern which, divided into 4 sections, contains information to make on-screens checks and alignments of the color demodulators and subcarrier frequency. For PAL it is used to check the chroma delay line for amplitude and phase (‘venetian blinds’). For the NTSC system, the pattern is according to the NTSC requirements and contains 7 color bars, -I and +Q signals and a black and white reference field.
I've been going over numerous pictures of pattern generator front panels and every time, the DEM button has no preview image or anything. Perhaps that's because it's a combination of test patterns. But I still can't figure out which patterns those are exactly.

Untitled.jpg
Untitled.jpg (87.35 KiB) Viewed 3615 times

Has anyone ever heard of (or even better: seen) the DEM pattern?
Post Reply

Return to “ELECTRONICS”