Subscribe via RSS
12Sep/210

PIKO VT135 Repairs

This happened to be another impulse buy from eBay... and I fully blame COVID. Anyway, it's a super-cool 4-wheel VT135 DMU (or Verbrennungstriebwagen) from the German brand PIKO.

20210912 133354 20210912 133403 20210912 133420

20210912 133438

The 'shell doesn't stay on chassis' defect was pre-communicated, but something else wasn't:

20210912 133445

It's missing an eye!

20210912 133525

They seem to be a triangular piece of transparent acrylic with a small hemisphere on one face. How hard can that be to design and print? I jumped straight into Tinkercad after a quick session with the ruler and whipped up the following:

VT135-Light-Pipe

5mm x 5mm x 5mm triangular block and a 2.8mm diameter hemisphere. I added a cylinder behind as the thickness of the VT135's shell caused a version without the cylinder to sit too far in. Once printed, the item was tested out...

20210912 141201 20210912 143947 20210912 133549

It didn't look toooooo bad... it's a little more opaque than the originals. The first shot above shows the very first print with no cylinder on the left and a 'shit print' on the right. Rule #1: clean the print bed after each print! Anyway, a third print was beautiful and its performance was as follows:

20210912 144507

It ended up being much brighter! Maybe I should replace the other three to even it all out... or maybe I'll try and work out how to printer clearer 3D models. You can find the STL here.

Filed under: MRR No Comments
10Sep/212

HoneyBee Mega Drive Controller Directions At 45°?

I've been fixing a bulk load of SMS/SMS2/MegaDrive stuff and one of these controllers was thrown in with a note stating "Erratic Directions."

received 898562814076309

Externally everything checked out, so I opened it up and continuity-tested the cable and plug. No issues there! I tested it again on the SMS2 that I had available and realised that I could get the directions I wanted by mashing in the corners of the D-PAD... what gives? I opened it right up...

received 544488250168490

What's going on here? The actual D-PAD circuit board contacts aren't in an NESW orientation? They're a box, flat on the ground? I continuity-tested for the UP button and it turns out to be the top-right pad. Just to confirm I wasn't bonkers, I put the rubber-contact-thingy back in the D-PAD housing and sure-enough, the pads match the pads!

20210910 181650 (1)

So wait, to get the direction I want, I REALLY DO have to mash in the corners of the D-PAD. This is BY DESIGN. I wasn't a very good gamer when I was young, and this system was available to me at that time. The range is Competition Pro, so I assume this was an answer to the kiddies who held the controller at 45-deg in their left hand and mashed the other buttons with their right? Google is giving me nothing.

NOTE: just looking at that first picture, you can see where your thumb is meant to rest. This easily hints at where UP is. Can someone please point me to documentation where this is made clear that the directions are 45-deg clockwise rotated?

Filed under: Retro 2 Comments
6Sep/213

Build Your Own Macintosh Classic!

Man, somehow I google'd across this link on creating your own Macintosh Classic and decided I'd do it myself. I'd already sunk cost into my own Kickstart'd Creality CR-6 SE printer and decided wtf, how hard can it be? The article even had a BOM that included all of the other physical components required. I placed the order, it arrived, COVID happened, box was stored, everything was forgotten.

Come Melbourne's lockdown #6 and I'm bashing through everything in the received-but-not-touched list. What to do first? Print the case. If that doesn't work, then who could care less about the tech purchased?

DSC03952 DSC03954 DSC03951

DSC03955

And with the printing, I screwed up! Make sure to configure your print settings with supports everywhere, not just 'touching base' or whatever the boring default is, as it won't work. I had to scrape the top inner frame of the display window to get it to not look too saggy!

DSC04001

The floppy disk is an insert and, as per the instructions, I added a white sticky-label to make it actually look like a floppy label. Once in the case it looks great!

Required Hardware

First off, we'll be using a Raspberry Pi Zero W, an old IDE cable and a 640x480 VGA screen for inside the case. Outside, some form of USB Keyboard and Mouse will be required to get everything installed. The Pi Zero is a very bare-bones unit and you'll need to get out the soldering iron, find some headers and solder up the GPIO interface.

DSC03989

From there, you just need to plug in the IDE cable and test it out. I did this first with just the standard RasPi install.

DSC03996

It worked fine... and was hilariously small.

Installing RetroPie

So, long-story-short, I tried the latest RasPiOS + yada and although the UI was lovely, the speed was shite. I then tried compiling my own BasiliskII and it just chuggggged. So, what's the answer? THIS IS THE INTERTUBES, someone has already done this: let me present to you RetroPie! Now, this is an amazing front-end + engines for Linux, to the point where configuration is out-of-the-box, but not so much for what we're about to do.... there's a bit of screwing around required!

First off, to get that Pi Zero W to boot, you're going to need to flash an SD card. On Windows, use the official Raspberry Pi Imager and choose RetroPie from the Emulators sub-menu.

rpimg1

rpimg2 rpimg3 rpimg4

Grab the card, a USB KB/Mouse and a display and boot the Pi. If everything works, you should be at a prompt to configure a gamepad?!

DSC04126

This was a little confusing for me as I didn't really care for a gamepad on this system at all. RetroPie expects you'll be playing Bubble Bobble, Snow Bros and Metal Slug, so it demands a controller configuration on installation. And so, with our goal being to play A-Train on System 7.5.5, we don't need a gamepad, but we'll still need to configure a device. This device will be a stock-standard keyboard and we'll need to tread lightly when mapping the buttons.

DSC04128

To get started, hold down a key on your keyboard for about 5 seconds. From there, please map the D-PAD directions to the arrow keys on your keyboard and then start=enter and select=space. From there, you can either spend time holding down any key to skip the association or just choose any key (don't choose the same key each time) to map to the millions of buttons. Once you succeed, the OK button will be highlighted and you get to press the key you mapped to button A.. do you remember?

DSC04132

If all is well, you'll have hit the screen above. This, in all it's glory, is RetroPie as a shell, with no engines underneath. Before we install engines, let's make sure we have full connectivity. Make sure that Configuration is showing under the RetroPie banner (use left and right buttons to select it) and then press the A button. You should see the following list:

DSC04127

From here, scroll all the way down to raspi-config (yes yes, the shot above doesn't show this highlighted!) and press A. You'll get thrown back to a console and raspi-config will load up in all of it's ncurses-glory. From here, configure wireless and enable SSH. Note that you'll be back to standard keyboard key mapping, so don't try and use the A button... just stick with your standard cursors keys and enter... escape'ing when you choose the wrong adventure.

Meanwhile, if you happen to select the wrong wireless country, you can hit escape to the main menu and re-select it in the Localization sub-menu by selecting WLAN Country.

SSH is under Interfaces and, once enabled, the configuration app will ask you to reboot. Do this. Finally, SSH in with your favourite terminal client using the credentials pi/raspberry.

     .***.     Sunday,  5 September 2021, 10:51:22
     *****     Linux 5.4.72+ armv6l GNU/Linux
     `***'
      |*|      Filesystem      Size  Used Avail Use% Mounted on
      |*|      /dev/root        30G  2.5G   26G   9% /
    ..|*|..    Uptime.............: 0 days, 00h14m35s
  .*** * ***.  Memory.............: 97496kB (Free) / 247472kB (Total)
  *******@@**  Running Processes..: 88
  `*****@@**'  IP Address.........: 192.168.1.57
   `*******'   Temperature........: CPU: 48°C/118°F GPU: 48°C/118°F
     `"""'     The RetroPie Project, https://retropie.org.uk

pi@classicpi:~ $

From here, let's cut over to the VGA display. This is done via the following:

pi@classicpi:~ $ cd ~/
pi@classicpi:~ $ git clone https://github.com/tianyoujian/MZDPI.git
Cloning into 'MZDPI'...
remote: Enumerating objects: 323, done.
remote: Counting objects: 100% (32/32), done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 323 (delta 15), reused 26 (delta 10), pack-reused 291
Receiving objects: 100% (323/323), 1.54 MiB | 599.00 KiB/s, done.
Resolving deltas: 100% (165/165), done.
pi@classicpi:~ $ cd MZDPI/vga
pi@classicpi:~/MZDPI/vga $ sudo chmod +x mzdpi-vga-autoinstall-online
pi@classicpi:~/MZDPI/vga $ sudo ./mzdpi-vga-autoinstall-online

... setup setup ...

Setting up libgtk2.0-0:armhf (2.24.32-3+rpt1) ...
Setting up matchbox-keyboard-im (0.1+svn20080916-12) ...
Setting up libgail18:armhf (2.24.32-3+rpt1) ...
Setting up libgtk2.0-bin (2.24.32-3+rpt1) ...
Setting up libgail-common:armhf (2.24.32-3+rpt1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libgdk-pixbuf2.0-0:armhf (2.38.1+dfsg-1) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...

ZERO-W

CM

2B

3B

3B+

CM3
pi@classicpi:~/MZDPI/vga $ sudo reboot

From here, reboot and disconnect your HDMI screen.

System RAM

I did note that my system was only reporting 256mb total system memory when it had 512mb on-board?

pi@classicpi:~ $ free
              total        used        free      shared  buff/cache   available
Mem:         247468       48468       91656        2932      107344      146248
Swap:        102396           0      102396

Turns out the boot configuration is allocating 256mb to Video RAM!? Let's fix that... we don't need anywhere near that much RAM for a 640x480 screen. Here's the important part in /boot/config.txt.

[all]
gpu_mem_256=128
gpu_mem_512=64
gpu_mem_1024=256

The three lines are the settings related to actual system RAM. We care about gpu_mem_512 and, as you can see, it's setting VRAM to 256mb! Change that to 64 and reboot. Don't try any lower as RetroPie will struggle badly.

Install Basilisk II

Jump back into SSH and start up RetroPie's setup application. Note that you can also do this through the front end if you're working directly on the unit.

pi@classicpi:~ $ ls
RetroPie  RetroPie-Setup
pi@classicpi:~ $ cd RetroPie-Setup/
pi@classicpi:~/RetroPie-Setup $ ls
AUTHORS          COPYRIGHT.md  logs           README.md             retropie_setup.sh
CONTRIBUTING.md  LICENSE.md    platforms.cfg  retropie_packages.sh  scriptmodules
pi@classicpi:~/RetroPie-Setup $ sudo ./retropie_setup.sh

From here, you'll be warned you shouldn't have paid for this... and I hope you didn't.

packages-1

You'll find Basilisk II (package:basilisk) under opt and Mini vMac (package:minivmac) under experimental. Note you'll also find OpenTTD under opt... I might try that for fun. All packages will ask you a few questions, I always default to install from binary.

packages-2 packages-3 packages-4

packages-5

After installing each package, you'll be brought back to that packages sub-menu offering options for the already-installed package... without it telling you that it installed correctly. Slightly confusing, but just press the TAB key to get Back highlighted below and then hit Enter.

packages-6

Go and install anything else you're after, whilst you're here, and then choose the reboot option at the bottom. You'll then get a final warning, of which you'll only need to heed if you've been tinkering with the front-end whilst waiting for this stuff to install... I should've mentioned above that you shouldn't do this!

reboot-2

So... reboot!

Configuring Basilisk II

This took a little bit of working-out before I got it how I liked it. Emulators on RetroPie have configuration/data in multiple places. ROMs (of which Basilisk II needs) are in the main users' (pi, in this case) home directory, whereas configuration is in the /opt/retropie folder. We'll be tinkering around everywhere to get this to work.

Although we've installed the Basilisk II package, the individual configuration file for it hasn't been created yet. To make it appear, we need to actually kick off Basilisk II once and let it error back to the RetroPie menu. Do this now by going back to RetroPie and selecting Start from the Macintosh menu. If everything worked, there'll now be a configuration file located in /opt/retropie/configs/macintosh/.

Next, download the fundamental items to get Basilisk II to work: ROM, OS 8.1 ISO. Expand both items locally and then copy them across to the ~/RetroPie/roms/macintosh folder. Rename the ROM file to mac.rom and the ISO file to anything you want, but make sure it matches the configuration below. Also make sure the CD image is read-only:

pi@classicpi:~/RetroPie/roms/macintosh $ chmod -w macos_81.iso
pi@classicpi:~/RetroPie/roms/macintosh $ ls -l
total 935696
-r-xr--r-- 1 pi   pi   420229120 Sep  5 12:01 macos_81.iso
-rwxr--r-- 1 pi   pi     1048576 Sep  5 11:35 mac.rom
-rw-r--r-- 1 root root         0 Sep  5 11:06 Start.txt

We'll also need to create a harddisk file which we will format and install OS 8.1 onto inside the emulator. The following command will create a 512mb blank file.

pi@classicpi:~/RetroPie/roms/macintosh $ dd if=/dev/zero of=disk.img bs=1024k count=512
512+0 records in
512+0 records out
536870912 bytes (537 MB, 512 MiB) copied, 63.6174 s, 8.4 MB/s

Note that we've called it disk.img. This is because the RetroPie configuration specifies this file on the command line and we'll just use that, instead of adding more config. We do have to do a few other configuration changes, so open up /opt/retropie/configs/macintosh/basiliskii.cfg with nano and update the settings as follows. Note that, if you want to change the allocated RAM, you should use a proper 8-byte value, so lookup the value here and update the config accordingly.

displaycolordepth 0
extfs /
seriala /dev/ttyS0
serialb /dev/ttyS1
ether slirp
udptunnel false
udpport 6066
bootdrive 0
bootdriver 0
ramsize 67108864
frameskip 6
modelid 14
cpu 4
fpu false
nocdrom false
nosound false
noclipconversion false
nogui false
jit false
jitfpu false
jitdebug false
jitcachesize 0
jitlazyflush false
jitinline false
keyboardtype 5
keycodes false
mousewheelmode 1
mousewheellines 3
dsp /dev/dsp
mixer /dev/mixer
ignoresegv false
idlewait true
disk macos_81.iso

The 'extfs' option defines the location of the 'Unix' drive that appears on the desktop. Note that, although there is an 'extfs' option configured above, RetroPie overrides this on the command line and sets it to the directory where we've just copied everything to. It's a great mechanism for copying files into the emulated machine, so you can copy extra things into this folder and then access them in Basilisk II. You can even do it while it's running... just close and re-open the Unix folder.

With the configuration saved, you should be able to choose start from RetroPie and ...

DSC04107

Hah, it booted and OS 8.1 is installing. Slowly!

Getting Audio Out Of A Pi Zero W

This wasn't easy! The Pi Zero W is a tiny board, missing many of the standard components so save cost. One of the components missing is an audio-out jack, but fortunately we can wire one up to the alread-in-use GPIO header. One note before you read any of the following: The pin numbering on the header is different to the connected pin numbers on the main CPU. Most of the time, when sites talk about GPIO18 or GPIO19, they actually mean the pin on the CPU and not GPIO Header pin 18 or 19! Grab and build the tools here and then run the gpio readall command:

pi@classicpi:~ $  gpio readall
 +-----+-----+---------+------+---+-Pi ZeroW-+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 | ALT2 | 1 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 | ALT2 | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 | ALT2 | 1 |  7 || 8  | 0 | ALT2 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 0 | ALT2 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 | ALT2 | 0 | 11 || 12 | 0 | ALT5 | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |   IN | 1 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 | ALT2 | 0 | 15 || 16 | 0 | ALT2 | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | ALT2 | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI | ALT0 | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO | ALT0 | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK | ALT0 | 0 | 23 || 24 | 0 | ALT2 | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | ALT2 | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 | ALT2 | 1 | 27 || 28 | 1 | ALT2 | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 | ALT2 | 0 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 | ALT2 | 0 | 31 || 32 | 1 | ALT2 | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 | ALT2 | 1 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 | ALT5 | 0 | 35 || 36 | 0 | ALT2 | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | ALT2 | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | ALT2 | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+-Pi ZeroW-+---+------+---------+-----+-----+

So, there's a lot to take-in above. Note it's mirrored, so start outside-in when reading. On both outside columns are the GPIO pins of the BCM CPU. We're looking for 18 and 19 in these columns. Above, I've already actually configured the unit for sound, so you'll see that these are configured for ALT5. To understand ALT5, you can read the GPIO mappings here, but just understand that both need to be ALT5 for PWM to come out of 18 and 19. These then map to header-pins 12 and 35 respectively. You'll find these two numbers in the inner two columns on the table above.

Next, we'll need a bit of physical hardware to interface with the GPIO header. Fortunately, since I have used an old IDE cable, we already have a point to connect into! The IDE cable has the middle header on the Raspberry Pi, one end on the LCD and, on the final end, we'll need to tap into pins 35 and 12. From these pins, we'll wire into a low-pass filter as per the circuit schematic here.

DSC04105

The VGA project specifically left GPIO18 and 19 free to let us have audio out, but they aren't enabled just yet. To do this, we'll need to edit /boot/config.txt once more and tell it to send PWM out the required pins. Add the following line to the very bottom of the file:

dtoverlay=pwm-2chan,pin=18,func=2,pin2=19,func2=2

The first note here is that func2=2 somehow equals ALT5, which is what we want. The second is that, with any future changes of boot config by any software, you should review this file and make sure this configuration is still at the bottom! Once confirmed, reboot and double-check that headphones are selected in raspi-config.

audio-1

audio-2 audio-3 audio-4

Save and exit and see what happens when you test with:

aplay /usr/share/sounds/alsa/Front_Center.wav

If the sound is quiet, then use alsamixer to adjust the volume.

┌───────────────────────────────────────── AlsaMixer v1.1.8 ──────────────────────────────────────────┐
│ Card: bcm2835 Headphones                                                    F1:  Help               │
│ Chip: Broadcom Mixer                                                        F2:  System information │
│ View: F3:[Playback] F4: Capture  F5: All                                    F6:  Select sound card  │
│ Item: Headphone [dB gain: 1.25]                                             Esc: Exit               │
│                                                                                                     │
│                                                                                                     │
│                                                                                                     │
│                                                ┌──┐                                                 │
│                                                │  │                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                │▒▒│                                                 │
│                                                ├──┤                                                 │
│                                                │OO│                                                 │
│                                                └──┘                                                 │
│                                                 90                                                  │
│                                            <Headphone >                                             │
│                                                                                                     │
│                                                                                                     │
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘

Bump the volume up to 90%.

Networking

So, TCP/IP to the internet should just work. AppleTalk to local ethernet devices probably won't work as AppleTalk packets don't survive over Wireless. I don't know why... but it's the same thing that happened when I was mucking around with physical LocalTalk adapters. Since I have another Pi on the network providing AppleTalk shares, I have the option to create a VPN and route AppleTalk over it to make it show up in Chooser auto-magically... but on a first attempt, the effort required is huge. I'll stick with manual IP entry for now, as that works fine!

The End Result

The screen is hilariously small, but games can be played!

241118466 361998575428700 6298152496122914924 n

The Pi Zero has just enough CPU to run OS 8.1 and A-Train. Audio works great and the MIDI sounds fine!

241139049 609410486890269 6802814062589133231 n

Shares are mounted via AppleTalk to the NAS and all is well!

Filed under: Apple 3 Comments
2Sep/2112

IBM 45U0018 POS Keyboard

I saw this unit on eBay and couldn't resist. It really did remind me of the department store POS keyboards and I remember them being clicky. I checked the photos on the auction and saw that it had a non-standard socket and no cable included. You can download the drivers/configuration-utility here.

DSC04101

DSC04081 DSC04082 DSC04083

DSC04089 DSC04086 DSC04096

DSC04100

The main keys are fixed, but the surrounding keys have optional translucent key 'covers' where inserts have been placed for special functions. Some of them even cover standard keyboard keys.

DSC04103

But yeah, back to the socket, and do excuse the photo...

DSC04099

It's very similar to a standard IDC Header, but in-set which makes it really difficult to use anything other than IBM's proprietary cables. After a lot of googling, I found that there's both a USB and PS/2 cable version available.

cable-options

Unfortunately, these weren't actually available anywhere... and if they were, the cost was out of control. It seems that these keyboards could also just dock onto the POS system above the till, so it's possible that the cable was only required if you wanted to mount the keyboard elsewhere. Anyway, a cable would be too easy... I'm sure we can work this out!

What does it look like on the inside?

With the hunch that the port supported PS/2 and USB, the keyboard was opened to work out the pinout. Opening it was actually very easy with just 6 small screws on the back. A large plate comes off and then there's just a bit of foil-cardboard shielding over the main circuit board.

DSC04061

Inside, of note, were a TUSB2046B IC and a STM32F103VBT6 Microcontroller with V0326_PF.bin programmed into it. The first IC happens to be the brains for a USB 4-port hub and provided a huge hint for determining the unit's wiring. I started tracing along the pins and the table below is the result.

ibmplug

Note that, when looking at the back of the keyboard into the socket when the keyboard is UPSIDE-DOWN on a flat surface, I've started Pin 1 from the top-right, with pin 6 then being top-left, pin 7 bottom-right and pin 12 bottom-left. This turned out to be silly as all the wires are in vertical pairs. Note this has been updated from the great resource at sharktastica.

Pin # Connected To Notes USB Cable
1 Pin 1 of T-46 aka TPS73633DBV Voltage supply for the power regulator. Must be 5v! Pin 1 - Red
2 Pin 1 of TUSB2046B DP0 = Root port USB differential data plus. DP0 paired with DM0 constitutes the upstream USB port. Pin 3 - Green
3 NC?
4 Pin 3 (or 6) of U4 U4 is not populated.
5 Pin 64 (PC7) of STM32F103VBT6 Microcontroller PS/2 Keyboard Clock
6 Pin 48 (PB11) of STM32F103VBT6 Microcontroller PS/2 Mouse Clock
7 GND Pin 4 - Black
8 Pin 2 of TUSB2046B DMO = Root port USB differential data minus. DM0 paired with DP0 constitutes the upstream USB port. Pin 2 - White
9 NC?
10 Pin 2 (or 7) of U4 U4 is not populated.
11 Pin 66 (PC9) of STM32F103VBT6 Microcontroller PS/2 Keyboard Data
12 Pin 52 (PB13) of STM32F103VBT6 Microcontroller PS/2 Mouse Data

Ok, so that's easy for the USB connection.. just wire the 'upstream' pins, +5v and GND into a spare USB cable. The other 2-pair of wires which run into the Microcontroller must be for the PS/2 mouse and keyboard? I wonder which is clock and which is data? There are plenty of images online showing microcontroller-to-PS/2-port hookups, so I'll try that after USB.

Hooking Up USB

USB cables contain 4 wires. First you need two wires for a very standard 5v DC rail and then you need two more wires to transmit and receive data. As you can see from the table above, we have all of these already mapped out. This was all very straight-forward thanks to the documentation for the TUSB2046B USB Root Hub IC. I grabbed a bunch of spare parts from the box'o'junk and started wiring something together. The USB cables I first tried to use happened to be power-only? No data lines! No wonder someone else threw them out.

DSC04065 DSC04070 DSC04071

Too short anyway! So instead, I remembered I had a mini USB socket in another tray'o'junk and set to wiring that up...

DSC04064 DSC04075 DSC04077

I plugged it into my RasPi 400 and it evicted all USB devices...

Sep  2 17:04:30 raspberrypi kernel: [63187.047153] usb usb2-port1: over-current change #1
Sep  2 17:04:30 raspberrypi kernel: [63187.202027] usb 1-1-port1: over-current change #1
Sep  2 17:04:31 raspberrypi kernel: [63187.278524] usb usb2-port2: over-current change #1
Sep  2 17:04:31 raspberrypi kernel: [63187.438880] usb 1-1-port2: over-current change #1
Sep  2 17:04:31 raspberrypi kernel: [63187.518607] usb usb2-port3: over-current change #1
Sep  2 17:04:31 raspberrypi kernel: [63187.678902] usb 1-1-port3: over-current change #1
Sep  2 17:04:31 raspberrypi kernel: [63187.758546] usb usb2-port4: over-current change #1
Sep  2 17:04:31 raspberrypi kernel: [63187.918864] usb 1-1-port4: over-current change #1
Sep  2 17:04:31 raspberrypi kernel: [63187.998562] usb usb2-port1: over-current change #2
Sep  2 17:04:32 raspberrypi kernel: [63188.238478] usb usb2-port2: over-current change #2
Sep  2 17:04:32 raspberrypi kernel: [63188.478480] usb usb2-port3: over-current change #2
Sep  2 17:04:32 raspberrypi kernel: [63188.718503] usb usb2-port4: over-current change #2
Sep  2 17:04:32 raspberrypi kernel: [63188.890074] usb 1-1-port1: over-current change #2

Ooops! Why am I chewing too much power? I google'd around and couldn't find an easy solution to inject my own power, as all answers indicated VCC needed to stay connected. Looking at my wiring again, I realised that this error was bound to happen as I'd wired the polarity around the wrong way! So, after correcting that...

Sep  2 18:44:47 raspberrypi kernel: [69203.309095] usb 1-1.3: new full-speed USB device number 9 using xhci_hcd
Sep  2 18:44:47 raspberrypi kernel: [69203.443182] usb 1-1.3: New USB device found, idVendor=0451, idProduct=2046, bcdDevice= 1.25
Sep  2 18:44:47 raspberrypi kernel: [69203.443193] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
Sep  2 18:44:47 raspberrypi kernel: [69203.449815] hub 1-1.3:1.0: USB hub found
Sep  2 18:44:47 raspberrypi kernel: [69203.452677] hub 1-1.3:1.0: 4 ports detected
Sep  2 18:44:47 raspberrypi kernel: [69203.779047] usb 1-1.3.4: new full-speed USB device number 10 using xhci_hcd
Sep  2 18:44:47 raspberrypi kernel: [69203.922725] usb 1-1.3.4: New USB device found, idVendor=04b3, idProduct=4604, bcdDevice= 3.26
Sep  2 18:44:47 raspberrypi kernel: [69203.922734] usb 1-1.3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Sep  2 18:44:47 raspberrypi kernel: [69203.922741] usb 1-1.3.4: Product: IBM Retail USB Alphanumeric POS Keyboard                                     
Sep  2 18:44:47 raspberrypi kernel: [69203.922747] usb 1-1.3.4: Manufacturer: (c) Copyright IBM Corp. 2008
Sep  2 18:44:47 raspberrypi kernel: [69203.922752] usb 1-1.3.4: SerialNumber: 44T4011-200811231006420977000036
Sep  2 18:44:47 raspberrypi kernel: [69203.935428] input: (c) Copyright IBM Corp. 2008 IBM Retail USB Alphanumeric POS Keyboard                                      as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.0/0003:04B3:4604.000D/input/input18
Sep  2 18:44:47 raspberrypi kernel: [69204.000545] hid-generic 0003:04B3:4604.000D: input,hidraw4: USB HID v1.00 Keyboard [(c) Copyright IBM Corp. 2008 IBM Retail USB Alphanumeric POS Keyboard] on usb-0000:01:00.0-1.3.4/input0
Sep  2 18:44:47 raspberrypi kernel: [69204.008558] hid-generic 0003:04B3:4604.000E: hiddev97,hidraw5: USB HID v1.00 Device [(c) Copyright IBM Corp. 2008 IBM Retail USB Alphanumeric POS Keyboard] on usb-0000:01:00.0-1.3.4/input1
Sep  2 18:44:47 raspberrypi kernel: [69204.016919] hid-generic 0003:04B3:4604.000F: hiddev98,hidraw6: USB HID v1.00 Device [(c) Copyright IBM Corp. 2008 IBM Retail USB Alphanumeric POS Keyboard] on usb-0000:01:00.0-1.3.4/input2
Sep  2 18:44:47 raspberrypi kernel: [69204.035363] input: (c) Copyright IBM Corp. 2008 IBM Retail USB Alphanumeric POS Keyboard                                      as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.4/1-1.3.4:1.5/0003:04B3:4604.0010/input/input19
Sep  2 18:44:47 raspberrypi kernel: [69204.036075] hid-generic 0003:04B3:4604.0010: input,hidraw7: USB HID v1.00 Mouse [(c) Copyright IBM Corp. 2008 IBM Retail USB Alphanumeric POS Keyboard] on usb-0000:01:00.0-1.3.4/input5
Sep  2 18:44:47 raspberrypi mtp-probe: checking bus 1, device 10: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.4"
Sep  2 18:44:47 raspberrypi mtp-probe: bus: 1, device: 10 was not an MTP device
Sep  2 18:44:48 raspberrypi mtp-probe: checking bus 1, device 10: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3.4"
Sep  2 18:44:48 raspberrypi mtp-probe: bus: 1, device: 10 was not an MTP device

DSC04097

HAHA. It just worked. It's very loosely-clicky, but not bad at all. Hilariously sounds like the registers at David Jones. The trackpad and touchpoint actually work beautifully as well. Very impressive. I assume there's further commands that could be sent to change LEDs, use the peripherals, but I don't need it.

PS/2 Wiring

I didn't feel like plugging this into a PC and restarting it 17 times to work out the wiring, so I used an Arduino Uno instead! Unfortunately, no combination of pairs would get the unit to produce any output. I'll have to do some more digging at some point in the future... a cop-out, I know, but I'm happy with USB for now!

UPDATE: There's a pinout here at sharktastica.

Printing a proper plug

I searched Thingiverse and found a very nice set of IDC Plug Frames. I then dragged that frame into Tinkercad and stretched it to make it fit better. The result is here.

IBM keyboard plug

From there, I used standard 'single' jumper wires to build the 6x2 inner plug and glued them in place. I then soldered up a spare USB cable.

20220315 173505 20220315 173756 20220315 174413

Perfect! Note there's still plenty of these keyboards on eBay from a WA seller. Highly recommended!

Filed under: Retro 12 Comments
1Sep/210

Dual Technologies SKD-4000

This beauty had been doing laps on eBay for a while. I had tried to low-ball it early on, only to receive a swift declination. A week or two later, I offered a little more and it was accepted! The seller took no time to send it to me, perfectly packed. It was listed as untested and with a cracked front-right case. Indeed it was, with one of the plastic clips actually hanging out the front of the opposing top-half, looking slightly like a buck-tooth.

DSC03857

DSC03829 DSC03831 DSC03833

DSC03840 DSC03839 DSC03843

DSC03851 DSC03853 DSC03854

DSC03856

After a little googlin', I came across a site talking about a slightly different version to this laptop. Turns out Dual Group were a Taiwanese manufacturer and built laptops that were then re-branded and on-sold. They therefore didn't really have their own site with any relevant info on this laptop. If anyone manages to find any information on this laptop, then please get in touch in the comments section! I therefore kept inspecting the unit, disassembling what I could prior to needing a screwdriver.

DSC03858

DSC03859 DSC03870 DSC03865

This unit didn't have a power supply, but thankfully the link above provided a pinout for the power supply their SKD-4000 needed. Under this unit, it stated it needed DC 20v @ 1.0A, so I tinned up a set of power wires and dialed in the voltage.

DSC03872 DSC03873 DSC03874

DSC03877

Jamming the wires in the power socket, after continuity-testing for GND, I flicked the power switch... lo'an'behold: the full orchestra of a vintage HDD and a POST beep!

DSC03880 DSC03883 DSC03886

The joy was very short-lived though... the BIOS quickly reported a low battery and incorrect date/time. Hardly surprising! I went into the BIOS anyway and did a HDD auto-detect.

DSC03894 DSC03895 DSC03890

DSC03896 DSC03891 DSC03893

116mb, nice! I saved the config and rebooted, but nothing seemed to have stuck. Seems I'll need to replace the battery to get further. Before that though, does VGA out work?

DSC03898

Nice! Ok, back to the CMOS battery. The link above provided a tear-down guide to help me, but in the end I didn't really need it as this laptop was surprising easy to open and work with! Even the CPU had a flap for easy access? It also has DIP switches for setting the CPU and they seem to configure the CPU pins directly? I'll try and decode them shortly.

DSC03904

The CMOS battery is a piece of work. It's hard-soldered in and it happens to be a rechargeable coin-cell. These are pretty rare nowadays... and... stupid me... I just tried to solder in a coin-cell holder and use a CR2032. DO NOT TRY AND USE NON-RECHARGEABLE BATTERIES IN-PLACE OF RECHARGEABLE BATTERIES!

DSC03929 DSC03948 DSC03958

Turning the unit on saw the coin-cell heat up rapidly, but fortunately I had my finger on the power switch, ready to prevent any spontaneous combustion. I then tried a 3.7v cell I had lying around, but the laptop started reporting 10 error beeps indicating that no battery was available at all. I really do hope I haven't trashed the charging circuit. At this point, I ordered an exact replacement Panasonic VL2330 battery and then looked for other things to fix up.

Power Plug

Whilst waiting for a battery to arrive, I realised I should solidify the power supply. Seems this type of plug is called a SnapNLock 4-Pin Mini DIN and I was pleased to see it available at Jaycar. I purchased a few (luckily) and attempted to wire one up. Soldering it was easy enough, but assembling it was next-level.

DSC03971

I mean, just look at the datasheet (which, actually, wasn't even east to find!), and you'll see what I mean... 8 components to jam together in a not-so-obvious order. I trashed the first plug and sorta-but-not-really succeeded with the second plug... it was good enough to test with.

Dip-Switch Dissection...

There are two blocks of four switches and, with no documentation, I set about trying to determine what these might control. Looking at the set closest to the CPU first, one can find the traces run off CPU pins.

DSC03975

Thanks to the glory of the internet, one can find pin maps and descriptions of pins readily available. The latter doesn't go into much detail, so actual CPU datasheets can also come in handy. After a little digging, it seems this block of switches controls maths error handling and interrupt line access to the CPU. I might just leave them as-is.

Dip-switch Name Solderable-jumper name Connected CPU Pin Pin Function
JP1-1 JP44 B15 NMI - Non-Maskable Interrupt
JP1-2 JP41 Can't tell... but seems to toggle the signal from JP1-1 through to JP3.
JP1-3 JP42 A15 IGNNE# - Ignore numeric error
JP1-4 JP43 C14 FERR# - Floating Point Error

The second block's traces disappear into the board's layers and are impossible to trace and understand.

The BIOS

Just for fun, I popped out the PLCC32 and read it in my Willem Programmer.

DSC03972

You can download the BIN file here.

Back to that Battery

A proper Panasonic VL2330 arrived and I soldered it in place. Applying power heard the same beeping. Ok, let's follow the traces to the left and see what's going on... two diodes, both seem to conduct power... then the voltage goes into pin 20 of that IC... with no marking? Why no marking?

DSC04002

Under the right light, it turned out to be an Epson RTC-6593 Real-time Clock. It even has integrated battery-backed RAM! Of course, this unit stores my BIOS settings. Why has the label disappeared? It's COOKED! It tried to burn me when I touched it. We can only assume it's due to my testing of other batteries... if only I'd bought the correct replacement at the start.

Replacing the RTC

So, I'm game to try this... what I'm not game for is fake chips! Searching for this IC has only come up with seemingly-dodgy sellers on Alibaba and eBay. I've just thrown in a few orders and we'll see what comes back. In the meantime I've removed the existing IC and cleaned up the area. Interesting to note that the silk-screen shows the IC should be an RTC-6583, whereas a 6593 was installed. The datasheet seems to indicate that 659x has "Extended Alarms" whereas 658x doesn't.

DSC04005

During removal of the chip, I just happened to remove a pad... I blame the fact that the IC was actually glued down to the board! I couldn't work out why the IC wouldn't move, regardless of the pressure I applied. Furtunately, it was a quick fix with winding wire and it's ready to solder up.

DSC04011 DSC04014 DSC04020

I'll post a Part II once the ICs have arrived.

Filed under: Retro No Comments