Sunday, 2 February 2025

Mini VIC Revisited Part 4 - Non Overlapping Two Phase Clock

This is a combination of a several Patreon posts from November 2024, the ongoing development of the Mini VIC clock circuitry.

When I designed the first version of the Mini VIC back in 2020 (the green board), I deviated quite a lot from the standard VIC20 design. Some of the changes were justified, but there was also a bit of "well I can do better than that" style arrogance.

It ended up being a bit of a flawed design, I over-complicated the ROM section trying to use a single ROM chip for character, BASIC and KERNAL ROMs, and over-complicated the RAM section trying to have all the RAM options when it is easier to just have the standard 5K and leave the rest to whatever you plug into the cartridge port (let's face it, it'll be a Penultimate Cartridge, won't it)

When I revisited that project (the new yellow board), I decided to go back to something a lot closer to the VIC20 design, picking and choosing from the best versions from various iterations of the design, the VIC-1001 the VIC20 2 pin and the CR versions.

One part of the design that I reversed was the clock circuit. I thought I should try to follow the original.

And the results were awful.

I have seen better clock signals coming out of a ZX Spectrum.

I am not sure if it is my implementation, the crystal traces ended up a bit longer than I would have liked. Maybe it is not suited to 74HC series logic over the 7402 or 74S02 originally used.

Either way, it has to go.

Back to the old green board

On the previous version of the Mini VIC, I had used a more familiar oscillator configuration with an XOR gate, and then used two more XOR gates to generate inverted and non inverted outputs. It should be the same latency though both gates, so should give perfect complimentary outputs.

I wondered if that was any better that the NOR gate version, so I fired the old board up. And yes, the output is much nicer.

The clocks were a lot cleaner.

My scope was playing up at that point, both clocks were as clean as the top one.

Regardless, the clocks were cleaner again, so I tried running the new yellow board from those.

It looked better, and ran for a while with no issues.

But there was still the occasional glitch in the colour RAM after testing.

I have yet to get to the bottom of the issue, but it is odd that it mostly affects the left of (rather ironically) the colour RAM line and the URL at the bottom of the screen (neither of which are on a page border or anything like that unfortunately

Back to the Schematics

There have been quite a few versions of the clock circuit.

According to the datasheet for the 6560, the idea is to provide two non-overlapping clock phases.

The oldest design is the VIC-1001. That had an inverter based oscillator, then a NOR gate flip flop, which should ensure the two outputs are non-overlapping.

The two pin VIC PAL model kept the NOR flip flop, and used the other two NOR gates on the same chip as the oscillator. They also added a 74LS74 flip flop to drop the 8.86 MHz clock down to 4.43MHz for the PAL VIC chip. (it only halves the one signal, the other would have still been 8.86 MHz, odd since they could have had two complimentary 4.43MHz clocks from the Q and /Q outputs of the flip flop?)

The NTSC VIC20 model also used a NOR gate oscillator, but rather than the flip flop, it just buffered (and in passing inverted) the two signals.

The CR VIC20s continued with the NOR gate buffers, but the PAL version got a 4.43MHz crystal, so it didn't need the 74LS74 any more. Now both inputs are 4.43MHz, the 6561 VIC chips seems happy either way.

For the revisited Mini VIC, I had gone with the CR version with four NOR gates, and added jumpers to select the two crystals.

After seeing how bad that was, I rejigged that as a bit of a hybrid of all of the above.

I have kept the NOR gate oscillator, but reconfigured the other two NOR gates as a flip flop.

That seems to give a slightly cleaner signal.

The 1.108MHz CPU clock is divided down from the 4.43MHz signal, and that is looking good, nice and clean after having been buffered by a NAND gate.

(if you want to know more about that side of things, see an old post on VIC20 clocks)

Did the clock mods help? No.

Diversion, Penultimate +3

I left that for a while because it was basically working, and turned out to be very useful when testing the Penultimate +3 Cartridge.

Available now from The Future Was 8 bit (yes, I know the URL says "plus two")

Revisited Clock Revisited

After the testing was complete. I wanted to have another look at the clock options.

I decided to go back to the oscillator circuit I normally use. That seems pretty reliable. I started with a 74HC00, and used one of the two spare gates to add an extra inverter (not shown) to generate a complimentary output.

I built that up on a small breadboard for ease of testing.

This is equivalent to the circuit used in the VIC20 CR, although that had an additional gate buffering each of those signals with an extra pullup, just due to the limited drive capabilities of those chips.

Those are much nicer clock pulse. None of the harmonics I was getting on the HC02 circuit

The problem is that it does fail the requirement for a "Non Overlapping Two Phase Clock".

The top trace goes high before the bottom one has gone low, due to the uneven propagation delay. The second signal is going through one extra gate to invert it, so it is delayed by 5-10ns, which isn't much until you consider the pulse is only 112ns.

At the end of the pulse you also get a period where no clock would register as high for about 20ns. That probably isn't a problem, may even be desirable, but the overlap at the start is still there.

Ideas started jumping around my head about delaying pulses by a gate or two, then ANDing them with the non-delayed version to get a clear pulse and a clear gap, but that looks like it would need most of a 74HC04 and a 74HC08 to implement it..

Time to look back to the original designs and the flip flop circuit used on the VIC-1001 and some of the 2 pins.

I turned the output into a flip flop using the other spare gate on the 74HC00.

I was disappointed to see that although it worked, the signal appeared quite asymmetric.

One clock signal was about 100ns, the other about 125ns (instead of the ideal 112ns). Maybe that is why they abandoned that in favour of just buffering the signal on later VICs?

Since that was also potentially caused by the difference in propagation delay, I decided to go back to my design from the previous (green) board.

Here I use the same type of oscillator circuit. This time using a 74HC86 so that I could use two extra gates to buffer the signal, one inverting, one not, to give the two phases of the clock with identical propagation delays.

The breadboard was revised again.

Well, that looks pretty good to me.

Perfectly synchronised complimentary clock pulses. Still slightly asymmetric, but not as bad as the flip flop.

Time to update the design for the next revision of the Mini VIC.

One the first board (the green one), I had used jumpers to select the crystal.

I am not sure that is ideal, so since I have a spare XOR gate, I think I will wire up both oscillators and select which of those clock signals is feed to the complimentary output buffers.

I don't think the noise from the two oscillators should be a problem. We will see. If you only ever plan to fit one type of VIC chip, you could only populate the parts for the oscillator you need and hard wire the jumper link. (I think I could possibly put a jumper to ground on pin 1 or pin 4 to disable the other oscillator if it turns out to be necessary?)

Further testing with the breadboarded 74HC86 based clock circuit seems to be working nicely.

I have been using the Penultimate tester as a soak test.

I am still seeing issues with colour RAM corruption in Dead Test, but I haven't noticed anything whilst testing any of the games. Again, it is affecting the same sort of place, this time the L of  the world COLOUR has been corrupted. It passed the actual test, but somehow got corrupted when it was restored after the test.

The various internal timing clocks and write pulses is something I plan to investigate, and again I thought that was best going back to the original design (in this case, the last version the VIC20-CR).

I need to get the logic analyser out and have a good look at what is going on with this lot and see if I can actually do a better job.

And yes, I still need to fix the chroma timing on PAL.


Adverts

The Mini VIC kits are not available yet, but there are still Minstrel 2 and Minstrel 3 kits available.

You can now get a Minstrel 2 kit for $200. 1980s pricing.

Or you can get a Minstrel 3 kit for $200

Patreon

You can support me via Patreon, and get access to advance previews of development logs on new projects and behind the scenes updates. These are often in more detail than I can fit in here, and this post contains bits from several Patreon posts. This also includes access to my Patreon only Discord server for even more regular updates.

Sunday, 26 January 2025

Mini VIC Revisited Part 3

Originally posted to Patreon, October 2024.

The PCBs arrived a while ago, but now is time to assemble a Mini VIC.

I have not made many yellow PCBs before, but this just seemed an appropriate colour match.

I put together the parts required. This is a new kit, so may need further tweaking. Lots of similar resistor values, 220Ω, 240Ω, 470Ω, 510Ω, etc. can these be optimised?

I did consider packing multiple kits, but I think a one off will do for now. (2025 update - still tweaking things - almost there)

That all went together without a problem. The edge connector for the cartridge port went in easily. On the previous board, I had the holes too small, so it was quite a job to finagle all the pins into the socket at the same time.

I don't like the way the sockets look when there is a mix of 14 and 16 pin chips, but when the chips are installed, or they are soldered direct they all align nicely as the 14 and 16 pin IC bodies are the same sice. I definitely need sockets in this case, there are likely to be some bodge wires appearing (2025 update oh yes, so many wires....)

Actually, there was one problem - the power switch.

I had carefully searched the datasheets for the exact type to match the original (top).

The one bottom left is the closest match. The right hand one was more easily available, but the rocker is too big for the case.

However, it appears there is one difference I had missed. The footprint is the same, but the pins at the front that are for support only are different.

The current type have a sort of ledge, which causes the switch to sit a few mm off the board.

The originals just had a pin, so it sat flat, something like this.

I have looked around and it seems those are the only type available now. I should be able to get around this by changing those pads to slots to allow the switch to sit flat as required.

For the moment, I attacked the metalwork with the side cutters.

That fits much better.

You will also notice above the switch there are extra pads around the power connector.

This is to allow a 2.1mm DC jack to be used instead of the 7 pin DIN.

I know the VIC20CR / C64 7 pin DIN power supplies are known to be unreliable, but I am not actually connecting to the 5V which can fail, I am using only the 9V AC, which is just a transformer winding, so should be fine.

Actually, it will probably be better than a modern switch mode 9V or 12V supply, and is a good way to use a power supply you wouldn't normally touch with a barge pole, and also one that goes perfectly with the machine.

I think this is the first time I have put a fuse on one of my designs, just staying true to the original, I guess they thought it was necessary.

Time to install all the ICs.

Well almost all of them. All the ones fitted are modern, still in production, low power, high speed CMOS chips.

The VIC chip is the one part I do not have a suitable replacement for yet, but let's test everything else before committing to trying with a precious VIC chip.

5V power is good, reset is there. It's about 2 seconds, maybe a bit long, I might reduce that a but by changing the resistor value.

The clock is a bit rubbish though.

Not sure what is going on there. I had a few issues with the scope / probes here. Both clock signals look awful, but they are different shapes. The trouble is when I swapped pins or entire scope probes, the top trace still showed the spiky stair version, and the other was showing something more rounded?

They have both been adjusted on the probe compensation pin. Something to look at another day, hopefully it will be good enough.

Time to try it out.

(imagine a picture of a black screen here)

The video output is disappointing though, black screen. Sync but no signal.

So the VIC chip is running, but has not been initialised.

I had set this board up to work with either a W65C02S or a MOS 6502. I wasn't sure if that was the issue, so I fitted the jumper (to get around them not being quite pin compatible) and a 1983 6502.

And that made no difference.

(another black screen picture)

I tried various things with the clocks (more in the next post), but finally gave up for the day.

...... time passes ......

The next morning, I was planning to write some test ROMs to toggle bits on the userport and things like that. But first, I decided to check the board over to make sure I hadn't made any stupid mistakes, like the wrong chip, or a bent pin or ....

.... a missed solder joint.

That would do it.

Let's try again.

Yay! A ready prompt!

10 PRINT tested

OK. So far so good. The video output is not great, and there may be a glitch in the colour RAM, but let's skip over that for the moment.

When I started out with projects like this, I like to set a goal. For the Minstrel 3, this was being able to play 3D Monster Maze. For the Mini VIC, it was loading Cheese and Onion from the Penultimate and it playing properly with the wider screen etc.

Nice, the cartridge port works, as does Cheese and Onion, sound and the joystick.

Rude not to have a go at EMH whilst I am here, make sure it's horizon trick was working.

A bit more testing, and the Penultimate passed a self test,

The Mini VIC passed the dead test. I will need to dig out the Commodore Diag cartridge and test harness and give this a full test later on, but so far so good.

The video output is not perfect, bit of a blue line to the left of the white.

The board is setup for Composite and S Video output, so I will give that a go when I make up the appropriate leads. I suspect the video circuit needs a bit of tweaking with values etc. I think I based it more on the one from the C64C, I might have to reconsider that.

There have been a few glitches in the colour RAM. I think may be related to the clocks. (the first sign of the mods there)

I thought it could have just been a flaky VIC chip, so I fitted a ZIF socket and went through my spares, but they were all basically the same (the working ones at least).

I also tried an NTSC VIC chip to see if that was any different. The video was clearer, no blue line, but still the occasional glitch with the colour RAM.

The plan initially is to go for a VIC20 replacement board.

I would like to also do a version with built in keyboard, but I think I should wait to see what happens regarding alternatives to the VIC chip.

Let's see how it fits in a VIC20 case.

Nice.

All looks good on the side as well.

Looks rather splendid, doesn't it.


Adverts

The Mini VIC kits are not available yet, but there are still Minstrel 2 and Minstrel 3 kits available.

You can now get a Minstrel 2 kit for $200. 1980s pricing.

Or you can get a Minstrel 3 kit for $200

Patreon

You can support me via Patreon, and get access to advance previews of development logs on new projects and behind the scenes updates. These are often in more detail than I can fit in here, and some of these posts contain bits from several Patreon posts. This also includes access to my Patreon only Discord server for even more regular updates.