Sunday, 9 February 2025

Mini VIC Revisited Part 5

Over the last few weeks I have been using the Mini VIC a lot for testing, and making a few minor changes along the way. Time to roll up all of those small updates. (this from Patreon November 2024)

Clocks

I identified the clock generation wasn't great in a previous post. I thought I should test out the theory, so make a clock generator that plugged into the 74HC02 socket on the Mini VIC.

I am a little worried that my bodges are getting neater.

I had already laid out the PCB, so I followed a similar arrangement.

This uses a more standard crystal oscillator approach. Two crystal oscillators in fact, so I am only switching the logic level clock signals rather than the connections to the crystal.

That works rather nicely and the system has been very stable throughout the Penultimate +3 testing.

I am pretty happy with that for "non-overlapping clocks".

I had an early NTSC VIC20 on the bench recently and took the opportunity to checked out the clocks generated on that board.

That looks a bit wobbly, but if I do the merge again, it seems clean enough (if the threshold is right).

I also captured the clock pulses on three other VIC20 boards I was using to test things on the Penultimate +3 but unfortunately I have lost all those traces.

When I get the Keysight scope that could do screenshots and save to USB, that was a game changer for showing scope traces in the blog posts. I use these a lot, so I have a script to automatically crop them to 4:3 these days.

When I looked for a USB stick to use, I found this 1GB USB stick that was otherwise not much use and thought it would be ideal. Turns out it wasn't. This USB stick has now spoiled three blog posts. It came from Keysight as part of some promo thing I guess in April 2017 based on the markings.

I lost a load of traces for the Sony cassette recorder post a few months ago, but reformatted it and it appeared to be working again. No more problems until today when it has failed again and lost most of the traces for this post and the VIC-1001 board repair post.


Power

I think the original 2 pin VIC 20 used a 9V AC power supply for convenience. That was the same way the PET had worked, AC in from a transformer and the rectification and regulation all handled on the board.

I am not 100% sure where the 7 pin DIN power supply was first used, the VIC20-CR, the Max or the C64?

Well, I say 7 pin, but many of them only had 4 pins connected. Two are 9V AC, and the rest are either 0V or 5V DC pins. All are wired in parallel on the socket, but the plugs often only have one 0V and one 5V.

It seems to suit the VIC20-CR best. The 5V DC is moved into the power supply itself, so that removes the need for the rectifier and regulator and the massive heatsink. The 9V AC is retained to be backwardly compatible with the userport of the previous model, and also used to generate an unregulated 9V DC supply for the datasette drive. It is regulated down to around 6V for that by the big TIP29 transistor near the port.

The Commodore 64 complicated things. Again the 9V AC is retained to be backwardly compatible with the userport of the previous model and for the datasette power. That unregulated 9V also provides power to a 7805 to generate a separate supply for the VIC-II and clock chip inside the tin can. But it also needs 12V. So the 9V AC feeds a voltage doubler to generate about 15V DC and then is regulated down to 12V for the VIC-II and SID.

Finally, a tap from the 9V AC is used to generate a line frequency reference, a 50Hz or 60Hz pulse that is fed to the TOD (Time of Day) input the 6526 VIA chips.

There are an awful lot of these things around. There is just one problem with them, well two.

Firstly, the 5V supply is flawed, and they quite often fail with the 5V rail rising upwards of 7V, taking out lots of the chips on the C64.

The second problem is they are potted, so you can't repair (or ideally replace) the 5V supply circuitry. Therefore, they should be avoided.

I had to hunt around to find this one for the photo. I have a box of them somewhere. I never use them. This one is showing about 5.31V on the 5V rail, so I wouldn't be happy using that.

I would be mad to design the Mini VIC to use one of those?

Well, I did, but with a very important caveat.

I do not connect to the 5V-7V DC supply at all. I ignore it and just connect to the 9V AC.

As such, it is quite a handy source of 9V AC from something which would otherwise be consigned to a box in a dark corner somewhere (or straight into e-waste).

I designed the board to accept either 9V AC or DC. The input is rectified to give 9V DC, and then regulated with a 7805 to give the 5V DC. The modern logic uses less power than the original board, so the approximately 1A rated supply will do just fine.

You can also power it form 9V DC if you prefer. There is no requirement for an AC dervied time of day signal (as on the C64), or any voltage doubler circuitry (as on the C64), or any other reason for AC on the board itself.

It is fed to the userport for use by external devices. I am not aware of any that specifically need AC. If any userport device requires AC, then feed the board AC. Otherwise, AC or DC is fine.

(and also note the caveat about 9V DC with a bridge rectifier and be aware of any ground loops or shared supplies - http://blog.tynemouthsoftware.co.uk/2024/03/why-dont-you-use-a-bridge-rectifier.html)

There are two sets of pads on the board, one for a 2.1mm DC power jack, as used on all my other kits, as well as one for the 7 pin DIN socket.

Testing

I didn't want to go directly to a C64 power supply, as I wanted to be able to monitor the current during testing, but I wanted to use the 7 pin DIN as that looked better for photos of the board.

I ended up making a 9V DC barrel jack to 7 pin DIN adapter so I could test both versions.

(actually, I made two. The first one I lost and I couldn't find it, so made a better one for these photos. I then almost immediately found the first one. It's been one of those weeks and it's only Monday)

(edit, as I come to post this, I have now lost both of those adapters)

However, the first time I tried it, it didn't work, totally dead. When I checked over, I found the fuse had blown. Not ideal.

I was impatient, so I tried clipping directly to the power switch pins and it worked fine, so I have just been using that throughout the testing.

Once I had finished testing, I had a look at fixing that.

I assumed I must have messed up the layout somehow to cause a short, or there was a solder bridge somewhere. I couldn't spot anything in the design that was wrong, so I took the board out of the VIC20 case and investigated further.

Well, there's ya problem.

Looks like I put the fuse holder too close to the edge of the board. I was trying to keep it away from the metalwork of the cartridge shield, and inadvertently moved it too close to the sideplate.

For the next revision, I have shuffled things around to move the fuse a bit lower, away from all the metalwork.

As a temporary fix, I desoldered that end of the fuse and cut the leg off. I soldered it to the trace on the top of the board and put a bit of tape over the bottom side.

One new fuse later and away we go.

The DC jack is connected to my bench supply so I can monitor the current use and try different voltages to check the limits.

The Mini VIC alone with a vintage VIC chip and MOS 6502 uses about 500mA. Add a Penultimate +3, and that rises to about 750mA. Still within the limits of the 1A supply.

If you need more power for accessories, use a more powerful supply.

I am impressed with how well the 7805 is going just rived to the board with no heatsink just a bit of tinned copper trace on the PCB. It gets warm, but no where near as hot as say the VIC chip.

I have had that running pretty much all day for several days when testing the Penultimate +3. (there are 250+ games on the menu, plus utilities, programming tools, file browser and different memory options, all of which have to be tested).

I will probably suggest a switching regulator for the final version, depends how things work out. Switching to a W65C02S should reduce that a bit. And VIC chip replacement current consumption is yet to be seen.

I did try it with the AC supply again, and it sort of works, but it seems a messed up with the reservoir capacitor. It was meant to be 2200uF, but somehow ended up as 220uF. With an extra capacitor clipped on, it worked fine.


Two problems remain.

  1. The chrominance signal is not very good.
  2. There occasional corruptions to the colour RAM only noticed during the Dead Test or similar soak testing.

(I don't have any of the video signal captures, I am going to have to do all those again, but not today. Frustratingly I have lost the before and after for the mods I did, so I will keep this bit short.)

Here you can see both problems. The R of colour has been corrupted and gone yellow.

This shows why composite video is never going to be as clear as RGB. Composite is just what it says, a composite of a sharp black and white image with some colour information overlaid on top of it.

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.

I have also turned back on EU shipping, with a caveat that there will be extra delays and charges at customs, sorry, nothing I can do about that.

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, 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.