Sunday, 10 March 2019

DivMMC Programmer Joystick Tester

The Future Was 8 bit has posted a couple of pictures of a nice new board with lots of flashing lights on recently, so I thought I would tell you more about it.
This board is used for testing the DivMMC future joystick ports. It sits on top of four DivMMC future devices, plugged into the four slots of the DivMMC future programmer (read all about that in it's own blog post).
Just a quick update on that first. It's been doing very well, testing every single DivMMC future that leaves the Pink Windmill, and there have been rather a lot of those.
However two years of heavy use is taking it's toll on the edge connectors, some of which were worn through to the copper in some places.
The boards used here were grey Spectrum 128K +2 boards, all of which were rescued from the junk pile (there's a blog post about them as well). They were all still working (they grey's are a pretty solid design), which is great. It would be a shame to have to replace them, so I designed a PCB which was basically an edge connector extender.
This is soldered onto the original connectors and presents a new gold plated edge connector, which will hopefully give many more years service - and if they get worn out, can be removed and replaced with a new extender board.
So, there are four Spectrum boards. Attached to those are the four extension boards. Plugged into those are four DivMMC future boards.
When plugged into the Spectrums, those boards are programmed (using software loaded from an MP3 player in the programmer box - you did read the previous blog post didn't you? keep up!).
The programming / testing process involves programming the firmware into the EEPROM onboard, and test loading some programs, including on which tests the joystick port.
Here the micrcontroller in the programmer box generates a series of actions on the joystick port. All 32 possible inputs (including the impossible ones like up and down at the same time), in sequence, with release inbetween to check for latching etc. (up, nothing, down, nothing, up and down, nothing etc.)
The software for the Spectrum end is loaded from the SD card by a series of automatic key presses generated by the micrcontroller in the box (are you impressed yet?). It will wait until it receives all of these in the right order and declare a pass or a fail on the joystick port.
In the original build a few years ago, a small blue box was constructed which was called the "joystick duplicator". It's job was to take the input from the microcontroller, which was a single joystick port, and apply those actions to all four ports, keeping them isolated from each other. (if you connected them in parallel, a short on one would cause all four to fail).
This small blue box was not bigger on the inside, anything but, so it had a miniature masterpiece of electronic assembly by TFW8b, following my design which was basically a 7404 driving five 4066 chips, each gate of the 4066 representing a joystick button.
The four cables coming out of that box plug into the for divs under test. I think these were salvaged from dead joysticks by the look of it.
This has also preformed great service over the last few years, but the joystick cables are getting a bit flaky and replacing those would require rewiring inside that box, so I designed a new version, this time on a PCB.
The design was simplified slightly. The original had used 4066s to give a little isolation in case the final design ended up having separate power supplies for the devices being programmed. I think we were considering using Spectrum still in cases at that point - presumably before I added the bit that 'pressed keys on the keyboard' (also using 4066s), which removed the need for keyboards and allowed the four units to be sandwiched together.
The new design uses 7407, open collector buffers. These will short the joystick inputs to ground when the inputs are low, and floating when the inputs is high (they will be pulled up by the resistors inside the divs, as would a normal joystick). That reduced the chip count, so there is just one for each port.
The board sits on top of the DivMMC boards, plugged into their joystick ports (which also serves to keep them vertical, and reduces wobble on the edge connectors). The screw threads on those connectors was the UNC 4-40 style used on D connector jack posts, so they had to be tapped to M3 to receive countersunk screws to hold them firmly in place.
The input connector is on the end, the cable runs down the back of the rear board, just out of shot.
Ooh, have we got flashy lights? Yes, the LEDs show the activity on the pins, and the four along side the ports show when those ports have power.
All being well, the testing completes and all the devices pass the test. Any that don't (and it's very few these days), can be reworked and retested.
Might seem a lot of effort to go to, but we want all the products that go out to have been fully tested, so we can be sure if anyone has a problem, they need to clean their edge connector, or have a broken Spectrum, possibly a Z80 with a bad M1 line.
The DivMMC future is available to order now, to suit all sorts of Spectrums, even white ones. As a reward for reading this far, here's a discount code: TYNEMOUTHDIVFUTURE for anyone wanting to buy a DivMMC future. For those of you that don't want to buy one, here is a picture of a cat looking judgemental.
Thank you to Rod Hull at the Future was 8 bit for all the photographs used in this blog post (including the last one).

Sunday, 3 March 2019

LHT00SU1 Logic Analyser and Sigrok

As part of an upcoming blog post, I am going to need to include lots of oscilloscope screenshots, and I have been looking at this device as an alternative.
My previous efforts taking photos of the screen of my 30 year old 'scope have varied from OK to awful, and often took many goes to get a usable image.
I looked around at various options, but they were all a little pricey, and unless I suddenly get a rush of new Patreon supports, they are a bit out of my range. So I thought I would try the cheaper end of the market. I picked up this device, the LHT00SU1 for less than £25 delivered.
It has eight digital inputs, and two analogue, so would be ideal for the task in hand, which was looking at a composite video output and the digital signals that generate it. These are all connected via a 10x2 0.1" pin header.
The kit came with some cables and clips, although I'll probably not use there as they are a bit rubbish and holding onto chip legs.
I'll swap them for E-Z Hook probes I use elsewhere. I have found these to give a good connection and cope with a but of moving around without falling off, although a set of clips does cost more than the analyser itself.
The LHT00SU1 is available from a variety of sellers, described as "Virtual Oscilloscope Logic Analyzer". Based on all the listings I looked at, none of these come with software. It turns out to be  a clone of the USBee AX Pro, a discontinued product from a manufacturer that has since removed the software suite they used to supply. Presumably as a result of their device had been cloned. I'm not sure what all these sellers are expecting you to do, most of the descriptions talk about XP software, so I guess you need an old XP laptop and get the old software from archive.org.
Looking inside, the heart of the unit is a Cypress FX2 chip (in this case, the CY7C68013A FX2LP). This is the sort of device where you plug it in and then firmware is downloaded to it and then it is detected as the end product. So without the original USBee firmware it's not much use.
A bit of googling comes up with Sigrok, the same open source software I use with my current logic analyser. That does support this hardware with fx2lafw, an open source firmware for these FX2 based logic analysers. This detects the device and allows you to select the firmware it uses.
With firmware on the device, it is detected by Sigrok as a CWAV USBee AX, with eight digital inputs and a single analogue input. It turns out the original device multiplexed with two inputs to a single ADC, the new firmware does support the switching, so you only get a single channel, but that's fine for my purposes.
I made up a set of test leads, including an analogue lead with a shielded cable and a phono plug on the end to pick up the composite video signal. I fitted a jumper on the second analogue input, to ground it, and somewhat shield the analogue input from the digital pins.
Time to hook this up to the device under test, one of my Minstrel ZX80 clones.
The E-Z Hooks are holding up well clipped to the chip legs.
I've entered a simple 10 PRINT program to fill the screen with X's so there is some data to examine.
Time to fire up the Pulseview program from the Sigrok suite. Good start, the device is recognised, and I've setup the channel names and run a capture.
That looks good, a whole screen's worth of video and the digital signals that built it up.
The analogue input has options so that it can be adjusted appropriately, here showing -1V to +3V to cover the range and that signal with space to spare. (although it's a bit annoying as this seems to get lost sometimes so you have to reset it)
Zooming in, it's less good. That was several horizontal lines making up a row of characters, and this is a single line.
It is clear from that screenshot that pulses are missing from the clock and load shift register signals. This would normally be cured by increasing the sample rate, and the device is meant to support up to 24MHz, but unfortunately whenever I select over 12MHz, the screen locks up when I click run.
So, I think this one goes down as a partial success. It's working, but not quite fast enough to show the information I need. Any suggestions for a device which will do the job?

If you want to support this blog, you can donate via Patreon or Paypal, or buy something from my store.

Sunday, 24 February 2019

Commodore 16 64K Upgrades

The Commodore 16 was always the nicest looking of the TED series of computers, and had the best case, a black version of the VIC20/C64 breadbin case, and best keyboard, a grey version of the VIC20/C64 keyboard. But it was the weaker of the two main TED machines in that it lacked several things. It didn't have a user port (although that wasn't used much it would have been nice), it didn't have the built in software suite (again, would be nice, but I'll manage without it), the main issue was it only had 16K of RAM.
Many game developers aimed for the lower common denominator and produced 16K titles that would run on the Commodore 16 and the plus/4, but there were quite a few titles that only ran on the plus/4 with it's 64K of RAM. It would seem the best combination you can have then is a Commodore 16 that has been upgraded to 64K (by the way, I've checked, and a C16 upgraded to 64K doesn't make a C64). I've seen many ways of doing this, and have tried to find the best one. The aim was to find a nice easy way that a C16 could be upgraded, in a plug and play sort of way.
First off, I've been through this all sorts of different ways, and concluded that it's just not going to be possible to do this as a cartridge without modifying the C16 board internally in some way. That's rather disappointing, but it boils down to this, the TED chip generates the RAM select lines, and this is the same chip used on the plus/4, so it generates these over the whole 64K range. The RAM chips themselves are wired up to know nothing of the upper two address lines, so the 16K RAM is mirrored four times in the 64K address space. No getting around that. The 4416 RAM chips are soldered to the board on every C16 I've seen, and are enabled over the whole address space. So as far as I can see it, there's no way to add a full 64K of RAM to the C16 without somehow disabling the onboard RAM, which is going to have to involve a soldering iron or something sharp and pointy.
But there are C16 64K RAM cartridges, how do they do it? Well, unless I've missed something, I can't see how it can be done without disabling the internal 16K RAM. I did find one cartridge from the 80s that had instructions (in German) which included a diagram instructing you to cut a track, this is the RAS line from the CPU, so will stop the RAM being selected.
Another (also in German) suggests cutting pin 9 of the two RAM chips, that is the 5V supply (yes, I know it's in an unusual place on that, carried over from the 4116 pinout), which should also disable them (although parasitic power could still be a problem, I wouldn't recommend that method). It also means you always have to have the cartridge installed as the internal RAM doesn't work any more.
Those seems to have been lost in the mists of time, and various clones of the C16 64K cart are on sale at the moment that don't appear to mention this. Without that, you get the internal 16K and the first 16K in the external cartridge running in parallel. That's not great, but both should be writing the same data to the bus. The problem comes when you access above 16K. The onboard RAM is mirroring the lower 16K, but the cartridge has different data, so both try to drive the data lines. The one closest the CPU wins, but eventually bad things happen to the other RAM chips, things get hot, things fail. It's not a good idea.

The technical bit

The TMS4416 RAM chips used are 4 bits by 16K. These are dynamic RAM, and so are addressed in two parts, a row and then a column. The row is setup first using the eight address inputs, A0-A7. The column then follows, but this only uses the A1-A6 pins, switched using 74LS257 multiplexor chips to A8-A13. This gives it a 14 bit address range, 0000-3FFF or 16K in total. A14 and A15 are not referenced, so the same RAM will also appear in the memory map at 4000-7FFF, 8000-BFFF and C000-FFFF. This means if you try to add any RAM to the system in the 4000-FFFF range, it will conflict with this onboard RAM. And that's the issue really. It may pass memory tests and appear to work, but it really shouldn't.
The plus/4 has a similar arrangement (although the style of the schematic is a little different). The key things to note here, is the 4164 chips used here (1 bit by 64K) have A0-A7 on the RAS selection, and A8-A15 on the CAS. These chips are driven by the same RAS and CAS signals from the same TED chip, so are active over the whole address range, but in this case, provide valid data over that range with no mirroring.
It may be clearer to look at the last version of the Commodore 64 mainboard. That used two 4464 RAM chips rather than eight 4164 as the earlier versions and the plus/4. Here you can see it is pretty much the same, other than the address lines are A0-A7 and A8-A15 and the RAM chips are 4x64K instead of 4x16K.
Here is the relevant area on the Commodore 16 board. The two RAM chips, bottom right are U5 and U6, and the two multiplexor chips are U7 and U8. So to upgrade the Commodore 16 to 64K, we need to remove the two RAM chips and replace them with 4464 chips, and rewire one pin on each of the 74LS257 mux chips, disconnecting 5V and attaching A14 and A15 (it doesn't actually matter which way around they go as long as they are both connected up).

This is where it gets to the choices. There are several ways this can be done, and I present here a selection of those. Each have pros and cons. All involve desoldering the chips, so should not be undertaken without suitable experience and equipment.

Method 1 - Permanent install

This is the way I normally do these modifications, it is permanent in that tracks have to be cut, but that's fine if you don't plan to go back to 16K at any point. Step one is to remove U5-U8. I use a desoldering gun and lots of flux, going slowly and carefully trying not to damage the board or the chips. If done properly, the chips will just drop out. No levering should ever be required,
Time for the modifications, first is U7.
Pin 2 is connected to 5V, this needs to be cut and connected to A14.
To do that, cut the track on the top of the board between pins 16 and 2. See later for alternatives if you don't like the idea of cutting tracks.
Next is U8.
Here pin 14 needs to be disconnected from 5V and connected to A15.
That is under the board, and the track is cut between the large 5V rail and pin 14.
That could have been done without removing the chip, but the 74LS257 (and particularly the MOS version of the 257, the 7708) are all common failures in machines of this era, so as I was removing the other three, it always seems a good opportunity to replace both 74LS257 chips.
A14 and A15 can be found in various locations, pins 26 and 37 of the TED chip, pins 21 and 22 of the 7501/8501 CPU, or I use two vias near by, just check for continuity with the above pins.
You can test first with the original RAM chips, just to make sure everything is OK, they should still operate as 16K.
Yes, still working. Time to fit the 4464 RAM chips.
And switch on.
Excellent, you now have a 64K Commodore 16  (which you are not allowed to call a Commodore 64). It's usually a good time to give the machine a bit of a test, one of the new Diag 264 cartridges with shinny gold plated edge connector.
I left that running for a while and all the tests passed (other than the ones needing human input or loopbacks which I wasn't concerned about).
And now, time to try out some of those plus/4 only titles on my new Commodore 64 64K Commodore 16.

Method 2 - Mod board

This was a machine that was sent in for repair. The owner had problems installing this 64K upgrade. Have you spotted the problem yet?
It is an alternative way of doing the same thing as above. The board plugs into two sockets fitted where the 74LS257s chips were and connects two new 74LS257 chips in their place, apart from the two pins that need to be redirected. It connects those via a switch to a two pin header, and a short cable connects that to another two pin header installed on the board where there are convenient A14 and A15 vias next to the modulator.
To install this, the four chips need to be removed and sockets fitted, and this is where the problems had happened. Cutting chip pins and then pulling them out one by one is not a method I would recommend, and in this case, had done a bit of damage. The repairs on the back, well, I'll let you judge.
I thought it best to remove the sockets to see what the board was like underneath, so I could repair the two missing tracks (you did spot those on the first picture didn't you?) and any other damage.
With the sockets removed and the board cleaned up, it wasn't that bad, and I was able to repair the places where the through hole plating had been lost, the two tracked that had been pulled up and lost, and the one that was hanging on by a thread.
With new sockets fitted and the tracks repaired on the back of the board, the module could be reinstalled and tested.
It's quite a near solution, but not for the novice solderer. A nice feature of that board is the switch which returns it to a 16K machine by switching the two address pins back to 5V.

Method 3 - Reversible version

Whilst using a board like that above does give a neat solution, I did try a third method, sort of a combination of both of the other methods.
Remove all four chips, U5-U8 and fit sockets.
At any point, you can reinstall the original chips if you want to go back to the original Commodore 16. You could maybe use less good sockets that would look more like the type they may have originally fitted if you like, but I prefer to stick with the turned pin versions.
No tracks have been cut, so to connect the higher address lines to the mux chips, I fitted new 74LS257s and bent up the two legs, pin 2 on U7 and pin 14 on U8 and attached some wires.
Those two wires then needed to be connected to A14 and A15, so I used the same trick the plug in board had used and fitted a two pin header to the leftmost two vias in the row of six by the modulator.
That gives a fairly neat install, it is fixed as 64K, but no tracks have been cut, so you can go back to 16K if you wish using the original chips you carefully removed before (you did carefully remove them didn't you? no cutting legs or prying out here please).
This last one is the Commdore 16 I recently fitted an internal SD2IEC to.
So there's a few different ways to do a 64K upgrade to a Commodore 16. Sorry there isn't a solderless method, address all complaints to the marketing division of Commodore in around 1984.

If you want to support this blog, you can donate via Patreon or Paypal, or buy something from my store.