Saturday, 24 January 2015

Commodore plus/4 USB Keyboard

This is a new addition to the range of USB keyboards, a Commodore plus/4 converted into a USB keyboard. I first built one of these two or three years ago when I briefly used the Arudino Leonardo as a base for these keyboards, but ended up reusing the bits to repair a plus/4 with a damaged case and missing keys.
I've had a request for one of these, so I've built a new one using the new USB keyboard controller boards. As with any of the USB keyboards I make, I don't like to take a working computer out of circulation (or even a repairable one). I think this one was an ebay 'untested' example.
The plus/4 has a number of Achilles heels. The usual issues of the 264 series (Commodore 16 etc.), the TED chip and the earlier versions of the 7501, both of which eventually burn out. There are also the common problems with computers of that age, the DRAM and mask ROMs. This unit looks like it has had a few parts swapped out, half the screws are missing and screwdriver marks on the sockets. The TED, CPU, and one of the ROMs were all faulty. The RAM however, was working on this, so I was also to use this board to fix another plus/4 which had faulty RAM I hadn't yet replaced. So that leaves a spare board with duff RAM, missing it's BASIC ROM, CPU and TED chip. Sadly, the only source for those replacement parts is another 264 series computer, so it's added to the collection of spare boards.
The other issue with these is the keyboard connector. It is an 18 way solid core ribbon cable. This flexes each time the case is opened, and this one had obviously been opened a good few times. If this flexes where it is soldered to the board,the connections eventually break. Often when there are multiple keys out on a plus/4, it is worth checking the cable, although you can also get the same fault with the TED chip or the 6529 driver chip.
This one had completely snapped. In these cases, I normally replace it with a pin headers at both ends and a flexible ribbon cable. Although not true to the original design, it tends to be a reliable solution.
In this case, I can mount the keyboard controller on the rear of the keyboard. It needs to be offset slightly as the case sides are stepped in. There is sufficient height for the same right angled pin header I used on the replacement ribbon cables, and a suitable header on the USB keyboard controller. This is the latest revision of this board, it is refined each time I get a new batch. This time I have standardized the mode switching through out the range, and shrunk it a bit more.
Since this means taking the keyboard apart, it's a good opportunity to give the keys and contacts a good clean.
The usual collection of keycaps, springs and plungers are cleaned, and it comes up looking very nice.
When making a keyboard with a mode switch, I normally replace the power LEDs with a tri-colour one, so I can use red for emulator direct mode, and green for remapped mode.
That's easy on the breadbin style Commodore cases, but here the power LED is part of the keyboard, and is an odd stepped rectangular shape.
I couldn't find an exact replacement, so I made one by filing down a normal round 5mm LED. This worked rather well, but it's a bit labour intensive,
I may just hot melt glue a normal flat rectangular LED in the case next time. With that connected to the board and the mode switch fitted into a convenient hole in the case, it's ready to assemble.
The firmware is almost identical to the Commodore 16, not surprising, given the C16 was basically this board with some bits removed and it relaid out to fit into the corner of a breadbin style case. The pin order is the same, offset by a few pins, and with some differences at one end (the plus/4 includes the LED).
There are a good number of familiar keys on the plus/4 keyboard, so mapping those is easy. Some odd things like dedicated keys for *, @ and £, but it gives me an opportunity to use shift to give some mising symbols, such as \ and €. There is also a set of arrow keys and function keys.
The buyer had requested the mode switch version, so I had to work out the reverse mappings to allow all the keys to work correctly when used with the Vice emulator. I had to do the same thing when I introduced the mode switch for the Commodore 64 models. It's always a bit strange, but I need to make the keys on the plus/4 keyboard send appropriate key presses to the PC so that Vice will reverse the mapping and show the key I actually pressed. This is based on position, so you press ctrl on the plus/4. It tell the PC you pressed tab. Vice says, ah, the user pressed tab, so I'll interpret that as ctrl. Strange, but it works well and give you the surreal experience of using a plus/4 keyboard to drive a plus/4 emulator.
The plus/4 USB keyboards are now for sale on my Etsy store. I haven't listed a Raspberry Pi version, but there shouldn't be a problem fitting one in.

Wednesday, 21 January 2015

ZX81 USB keyboard

I've been refreshing the range of USB keyboards I sell in my Etsy store. Every time I get a new batch of boards, I always tweak the design a bit. I'm refining the design, and adding new features each time. This time, I updated all of them to bring them all up to a similar level. I had added mode switches to the Commodore 64 and ZX Spectrum, but in various different ways. I have now settled on one standard set of options and rolled that out across all the designs.
Coupled with this, I've rewritten a lot of the firmware so that things like mode selection are all handled by the common code. It's take a while to move everything across, but the main ones are done now. There is also a special version of the Spectrum board for use with a Raspberry Pi.
I'm going to go through each of the keyboards, build up a new one and show off the new features. The first USB keyboard I built was the ZX81, about 4 or 5 years ago. I wrote it up a year or so later on the blog. Things have changed quite a bit since then.
The board was hand wired pad board, and used a software level USB stack, V-USB, on the ATmega328P. It was programmed in the Arduino environment, and the arduino serial programmer can be seen above. I used a new membrane as the original was damaged beyond repair, so had the luxury of long tails and mounted the board on the bottom of the case (not sure why though?). This evolved over the years, firstly to Arduino Leonardo based boards, then to custom boards. The software also evolved as there were issues with the various frameworks I used and how they dealt with the keypresses and key mapping, so I went my own way.
Now we move to 2015. and things have changed quite a bit. I'm now using ATmega8U2 microcontrollers with hardware USB implementation, running my own firmware on a custom PCB, there is even a USB PID for 'Tynemouth Software USB keyboard'. The board is now mounted on the underside of the lid, which is more sensible, and means I can make use of membranes with damaged tails. These have a tendency to crack a centimeter or so from the end, and need to be cut back to get a solid connection. However, when cut back they wouldn't be long enough to use with a normal ZX81 board, but can still reach the connectors on the USB keyboard PCB.
In common with the other boards, this can have the option to switch the mode in use, or can have the mode preset via jumper. On the ZX81, the mode switches between direct mode which is one to one key mapping. There are only 40 keys, so A-Z, 0-9, shift, enter, space and fullstop. The remapped mode uses shift to select various symbols and function keys.
There is no LED to indicate mode in the way I do on the Commodore keyboards, so I use a small sounder to beep when the mode is changed. This also allows me to use an idea borrowed from the spectrum, whenever a key is pressed, it makes a click sound. This does seem to make typing on the membrane keyboard a more pleasant experience (I am typing this on the ZX81 now).
I have a soft spot for the ZX81 as it was the first computer I programmed back in the early 1980s, and indeed the first computer I repaired when it died a few years later. So it is nice to be able to have one around, I still use one to control a living room media PC. You can buy one of these now at the Tynemouth Software Etsy store, or get one with an integrated Raspberry Pi.

Saturday, 17 January 2015

USB to IEEE-488 for Commodore Disk Drives

Here are the details of the USB to IEEE-488 / GPIB adapter I have been using to test the Commodore Pet IEEE-488 disk drives.
Like the USB to IEC adapter I build last year for testing Commodore 1541 disk drives, this one is based on xum1541 firmware. That needs to run on an ATmega32U2, and as before I adapted one of my USB keyboard PCBs for the purpose. The latest PCB for the ZX81 adds a sounder to click on each keypress (which makes typing easier), and a mode switch. That leaves a pile of the old style PCBs for tasks like this.
I've added a piece of padboard to add the additional circuitry, held in place with a couple of cable ties and by the resistors which bridge the boards.
There are 8 grounds, 8 data lines and 8 handshaking lines on the 24 pin connectors, I've wired all those to short lengths of wire.
The two LEDs for power and activity fit in the lid.
The rest of the circuit (a 7406 hex invertor) also goes on the padboard, and it is all wired together.
That just fits in the box.
The circuit is actually the same as the IEC version, so I could have added a 6 pin DIN socket, but there wasn't space. Once complete, the unit plugs into the back of the disk drive.
I had forgotten the 8250 drives have the connector mounted upside down, so the LEDs are pointing downwards. I should be able to turn the connector round later on, although it is the right way around if testing with the board loose though.
However it's connected, the drive can be accessed using the xum1541 versions of the opencbm command line apps.
The CMBXfer GUI also works with this
It also works with the 1541 disk drive converted to a 2031.
I don't think anyone expected these two things to be connected together, so it is not recognized by the detect command.
I'm having a few problems with the 2031 clone responding intermittently. I'm seeing the same problems talking to the drive from real Commodore Pet computers, so I don't think it's this adapter at fault. As a test, I went back to the 8250 disk drive, I tried copying a .d82 disk image to a real floppy disk.
Don't be fooled by the progress bar, that's only the first track of many.
It took almost half an hour to copy the whole image, certainly a good test of the adapter and the drive.
Once complete, a directory showed just how little was actually on the disk image, but still it had been a useful test, and I now have an 8250 demo disk to test the drive out.
Checking the disk on a real computer, the files have transferred correctly. Another useful bit of kit to add to the collection.
As ever, credit to those who created the xum1541, opencbm, CBMxfer and other tools I have used.

Saturday, 10 January 2015

Two very different PCs - Custom built vs HP

I have two very different PCs on the bench today, and it's interesting to see just how different. The one on the left is one of my custom built PCs I'm just putting together. The one on the right is a generic off the shelf HP unit. Prices for the custom ones start around £400, The HP one would cost around £300. So what do you get for the difference in price, which one would you like?
From the front, the two look fairly similar, smart black cases, one badged Fractal, and one HP. One matt, one shiny (both with finger marks). Both have DVD RW drives, the one on the HP is hidden behind a flap. They both have two audio jacks, and two USB, the custom one has one USB 3.0 and one USB 2.0, the HP has both USB 2.0. It also has an SD card slot.
From the back, the difference is a lot more noticeable. There seems to be a lot of sheet metal on the HP on the right, and lots of mesh on the custom one on the left.
Looking at the custom built one in detail, on the rear is the mains input and power switch, then an I/O plate with a PS/2 port for anyone planning to keep an older style keyboard, four USB 2.0, two USB 3.0, gigabit LAN, SPDIF, four display options: HDMI, Display Port, VGA, and DVI, and six audio jacks. There are also four expansion slots, and there will also be a Windows 7 licence sticker going on there.
Inside, there is lots of opportunity for expansion, PCI express 3.0x16 slot, two PCI express 2.0 x1 and one PCI express 2.0 x8 slot. There are also a lot of additional power supply cables hidden in the spare drive bay, and the 430 Watt supply has much extra capacity. The processor is a Haswell i5, these are very solid chips with build in memory controllers and fairly decent on board video. The storage is a 250GB SSD, making full use of the SATA 3.0 on the mainboard at up to 560MB/s. Two of the four RAM slots are filled with 4GB DDR3-1600 sticks, these run in dual channel mode, so I'm getting a memory access speed of 18391 MB/s in memtest.
There are headers for additional SATA 3 hard drives, and header for extra USB ports, even parallel and serial if required. Cooling is via the intel stock cooler, which is fine for these modern intel processors as they just don't get that hot even at full pelt. There is also a 120mm case fan balancing the air flow with the 120mm fan on the PSU, giving neutral pressure in the case, reducing dust build up.
Looking in detail at the HP, it's a little different. No mains input, as it actually uses a 90W laptop style power brick. That does get a bit warm as it was drawing about 80W in use. It may be the mechanical hard drive making the difference, the custom one draws about 40W.
The other connections on there are two video options (DVI and VGA), four USB 2.0, gigabit LAN and three audio ports. Inside, it is fairly empty, although the case looked like it could accommodate a standard power supply and PCI expansion cards, inside it is clear it doesn't.
There is a mini PCI Express socket, with a WiFi adapter installed, but other than that, no opportunity to expand. The processor is the older Ivy Bridge i3, but at least it is an intel, most of the cheaper units use AMD chips, and I see lots of dead AMD laptops, so I'm not a fan. There is a single stick of DDR3-1600 RAM running in single channel mode, so it scores 9425 MB/s in memtest (half the speed of the custom one in dual channel mode).
The hard drive is mechanical 1TB drive, reading at about 80 MB/s. Most people seem to only use a few hundred GB at most, so the money would be better spent on a smaller but considerably faster SSD (about 560MB/s). HP have used their traditional slightly rotated Cooler Master heatsink and fan, and a rear 120mm fan. This arrangement pulls air into the case where ever it can, which is why you get dust build ups around any gaps or holes in the case.
Printers have become pretty much disposable items, this looks like they want PCs to go the same way. The HP board is non standard style, so it will be difficult to replace in the future. The case has 'security' screws in case you wanted to go inside, but they are just T15 and there is usually a full set of TORX bits in all these 101 bit screwdriver sets these days. So it seems to be designed to be plugged in and used and then thrown away in a couple of years time without ever being opened. That may be what people want?
When I build a custom PC, it has thumbscrews on the case, feel free to look inside. I like to do a proper job of cable management and a tidy case makes for better air flow. I use good quality, reliable parts, these all have at least three year warranties, and are standard sizes and easy to replace or upgrade in the future and to should last a long time. The system runs cool and quiet, and with the lots of RAM in dual channel mode and an SSD, very fast.

The HP is in for repair two months after the 30 day Argos warranty expired.

So which one do you want?