Category Archives: BBC Micro

Upgrading My Acorn A3010

Upgrading My Acorn A3010

I also made this page, to help someone install the DualClock board in their A3010.

Background and Repair

Battery damage repairs – Thankfully the floppy port was OK

I don’t remember exactly when, but at some point around 2000 my parents got me an A3010. I didn’t have any software for it beyond what was in ROM and didn’t really know anybody with an Acorn, so I basically just used it as a faster BBC Micro, especially as it had an Analogue / Userport podule in it and I was starting to get into electronics (slowly) during my later teens.

I used it intermittently for a few years, until I left home and couldn’t easily take it with me for the first few years.

Later, I had it in the house but hadn’t really done much with it other than test it once to check it worked. After that, I hadn’t used it for a few years when a collogue warned me that the batteries caused serious damage (in about 2014). I went home and pulled it to bits to find green corrosion and a dead battery. I cut the battery out and cleaned it as best as I could with IPA. The trace damage didn’t look like something I knew how to repair so I sadly packed it away hoping to work out what to do at some point. At least the battery was out of it.

The year : 2021 – the world is in disarray as a pandemic sweeps the earth and I had accidentally bought a dead, battery damaged Macintosh IIx… and was surprised to discover that it turns out I am now comfortable doing trace repairs. I’d also picked up an ultrasonic cleaner and decided to take the chance to clean up and have a look at the poor A3010. Looking at the board again, I found that it wasn’t as bad as I thought and a small number of trace repairs later and a clean, and I had it up and running. (Note that the traces to the parallel port are not in great condition, but do all conduct. I may return to tidy them up a bit at a later date, by re-tinning and covering with fresh soldermask).

Functional still… but ugly and in need of pre-emptive work

Upgrades

Excited to have a working Acorn, I decided to upgrade it to say sorry for abandoning it for years. I bought a Gotek, IDE card from IanS and 4MB of RAM. Further investigation found mentions of quite significant overclocks being possible, especially when using a fast 4MB RAM upgrade, as this disables the onboard RAM.

IDE Podule and 1GB DOM

Overclocking

The description of the overclock explained how, but not why this was possible, which made me a little uncomfortable so I decided to investigate. Why is it possible to overclock some (not all easily – some do not have the unpopulated footprint for an additional clock) A3010s by just adding an additional clock and a resistor?

The following extract from the ARM250 datasheet was interesting as it describes the standard configuration for an A3010 – the 72MHz clock is divided by 2, and then again by 3, to produce the 12MHz for the processor and for the memory. The next paragraph then goes on to explain that it is possible to use an alternative clock source and even references running the chip at 16Mhz (with no warnings or statements that “this is not advised”).

ARM250 datasheet extract 1

Further into the datasheet, there is a description of pin functions for the ARM250 that includes a description of “sysclk”. This is the optional input described above, and the description explains why this pin makes overclocking so trivial.

ARM250 datasheet extract 2

Apparently, the act of connecting an active clock in the correct speed range alone is enough to cause the ARM250 to automatically detect it, and switch clock source from clk72 (divided by 6) to sysclk (divided by 3). If no signal is detected and the pin is held high, it switches back to clk72. There is even conveniently a pullup on the pin so if left unconnected (as by default on the A3010) it is pulled high and disabled.

The following drawing also helps understand how everything works, showing how the chip is able to select from two sources, and where the dividers sit.

Diagram of ARM250 clock arrangement

Next I pulled out various related schematics I had, some using sysclk and some only clk72. It should be noted that, firstly, the mezzanine A3010 is implemented in a slightly different way because they do not derive the clock by dividing by 6. Documentation states that this was done to avoid expensive clock dividers. Secondly, my A3010 is a later board revision and frustratingly does not match either schematic. The following is the mezzanine A3010 design. This variant uses sysclk, but it only implements a divide by 2. Note also that Clk72 is only 36MHz instead of the obvious 72MHz. This is due to the cost optimisation. Note that between the Clock X3 and sysclk a 33R resistor has been placed in line – make a note of this. Ignore that the mezzanine board is confusingly labelled “ARM250”.

Mezzanine A3010 clock circuit schematic extract

The following schematic extract is for the intermediate age A3010 which used the ARM250 chip rather than the mezzanine board.

ARM250 A3010 clock circuit schematic extract (early?)

Here we can see sysclk is completely unconnected and X4, connected to clk72, is a 72MHz crystal showing that now, in line with the normal operation of the ARM250, the processor clock is one sixth of clk72. On boards of this design (with no footprint for a clock connected to the sysclk pin), modifications are still possible, but more complex. It would be necessary to tack a wire onto the processor pin, find ground and 5v and then wire in a resistor and a clock. Not impossible… but care would need to be taken.

Finally, the following is a schematic for the A3020. This schematic shows an implementation using an ARM250 (not a mezzanine board), but, with a position for sysclk.

A3020 clock circuit schematic extract (similar to my A3010)

Note two things here 1) while overclocking is likely possible by placing a fast clock at location X100, for a significant overclock I suspect it would be necessary to replace the RAM soldered on the motherboard with faster chips and 2) the clock shown in the schematic is 40MHz meaning that a machine built as above would be 13.3333MHz?! I anticipate that on machines that were sold, no clock was fitted at this location on the A3020, possibly confirmed by photos at BeebMaster and Chris’ Acorns.

The most interesting thing for me about this A3020 schematic is that this section more closely matches my A3010 than either of the A3010 schematics. Note here that the resistor located in line with the clock signal, between sysclk and X100 is in this case a 22R resistor. Given this schematic uses the same design as my A3010, I decided I would use a 22R resistor.

Using a 22R resistor contradicts the article on Vectorlight as they have used a 220R resistor – I suspect this was a result of confusion at some point. A surface mount 22R resistor is labelled “220” in this situation, the first two numbers are the significant figures, and the final number is the number of zeros. A 10k resistor would be 103 (ten and three zeros), so 22 and no zeros is 22R. I recommend that anyone following these instructions uses a 22R resistor. The footprint on the board is the size “0805” a bit small but not too difficult to solder if you use a bit of extra flux.

Implementing the Upgrade

From the above, I now knew that I needed only two things – a DIP14 (or DIP8 – both work as the footprint supports both) style 5v output clock (TTL or a compatible CMOS etc.) and a 22R 0805 package resistor. To this, for convenience, I added a DIP14 socket, so I could easily swap in and out different speed clocks (“easily” I still have to half dismantle the computer, but at least I don’t have to keep desoldering clocks).

Removed socket pins (caps are from another project)

With the socket, I used a small pair of pliers to grab the 8 pins which were not needed and push them upwards. I then grabbed them from the top side and removed them. This left the socket with 6 pins in the locations matching the footprint on the motherboard. Note the notch on the silkscreen and on the socket as this tells you the correct orientation.

Solder mostly removed from X3 and the 6 pin DIP14

Next I used good quality solder wick along with some flux to remove the excess solder from the socket footprint for X3 (the location on my A3010 where the sysclk clock can be fitted). I find the best way to do this is to apply flux, add new solder and they use the solder wick to remove it. If it doesn’t all go (like the higher middle location in the photo above), try from the other side (after adding extra flux). If it still doesn’t clear, add more fresh solder (even though this is counter intuitive) and start again. Take your time and don’t keep your iron on the board for too long. Also, don’t set the iron too hot. Around 300 degrees C should be enough, certainly no more than ~330 degrees C.

Socket in place in X3, R76 waiting to be fitted

Once all 6 holes have been cleared of solder, you can install the socket (taking note of the notch on the socket and on the silkscreen). I tend to tack one corner first, then with the socket downwards, place my finger on the socket and touch the iron to the single fixed pin so that it reflows and the socket sits flush on the surface of the PCB. Visually inspect before doing the same with the diagonally opposite pin… and if you’re happy it is installed properly, solder the other pins.

R76, a 22R 0805 resistor, soldered in place

R76 then needs to be fitted as above. First clear the pads of old solder using a bit of flux and solder wick. As mentioned, the 220 label means that this is a 22R resistor. To solder this, I place a small amount of solder on the pad closest to my soldering iron hand, and then briefly remelt this solder while using tweezers to push one end of the resistor into the solder and the whole thing into place. I then solder the other end, before applying a small amount of flux to each pad and reflowing them briefly to tidy them up. Don’t worry too much if it is scruffy, as long as the solder doesn’t bridge the two pads.

Ready to go – this 48MHz clock causes the processor and RAM to run at 16MHz

Fit a clock into the socket, taking care to note pin 1 (shown above by a dot next to “05”) and align it at the end with the notch in the socket and silkscreen. Note that if you use a shorter DIP8 style clock, you need to make sure that pin 1 is in the same location as with the DIP14 part. This means that the clock would be at the far end of the socket from R76.

With the 48MHz clock above fitted, the A3010 ran at 48/3 = 16MHz, a 33.3% speed boost. I also later installed a 54MHz clock to give an 18MHz clock speed.

16MHz Processor and Memory

As I am using a RAM module rated at 60ns, 16MHz is within specification for the RAM, and 18MHz represents a very slight overclock (55ns).

IFEL 4MB RAM upgrade using 60ns chips

Note that interestingly, if you remove the clock and just leave the socket empty, your A3010 will return to its default 12MHz – this modification is trivial to “turn off”.

Turbo Mode

“DualClock” concept

After having overclocked my Acorn, I started thinking. The DIP14 clocks are enormous, especially compared to more modern surface mount clocks that are functionally identical. I decided that I could probably fit 2 or 4 clocks on a small PCB that fit into the space envelope of the original part! A bit more investigating and I found that a commonly available 7x5mm clock package would fit one per side on a board the size of the standard clock package, with a SPDT switch (or header for a remote switch), allowing you to pick your clock speed.

Draft PCB Render

I created a schematic and board layout and ordered some boards to test the idea. A couple of weeks later they arrived and I made one up to test during my lunch break.

Bare boards – resistor for (unhelpful) scale
Under assembly
Complete!

This test device is fitted with a 50MHz and a 60MHz clock, which results in a processor and RAM speed of 13.33MHz and 20MHz respectively, dependant on the position of the switch (in the current design, as photographed above, towards the camera selects the upper clock, and away selects the lower clock).

DualClock in situ (note the heatsink on the SOC)

The excellent news is, it works! Note that by this stage I had fitted a standard 40x40mm heatsink. I also fitted a rectangle of aluminium to the RAM.

A crude “low profile” RAM heatsink

Both heatsinks were attached using a thermally conductive silicone glue, as I did not want them coming free inside the case.

Switch position 1

The photo above shows the A3010 running with the switch selecting the 60MHz clock and the following photo shows with the 50MHz clock selected.

Switch position 2

I do not advise switching the switch while the computer is running as it is likely that there will be some unpredictable states as the switch changes position due to switch bounce and the speed at which the two clocks respond. It is very likely that both clocks might be active at the same time and cause a crash.

To test the 20MHz overclock, I left the Molecule example running at maximum (unrestricted) speed for over an hour. The SOC temperature peaked at about 29 degrees C (in the photo I’m not hitting the right place on the heatsink, down between the fins).

Measuring the temperature of the SOC heatsink

The RAM, to my surprise, was cooler at approximately 25 degrees C.

Measuring the temperature of the RAM heatsink

Next Steps

My intention is now to build a second PCB with a 60MHz and a 72MHz clock. This gives 20MHz and a 24MHz processor and RAM speed. My preference would be for 18MHz and 24MHz, but I don’t have a 54MHz SMD clock. With this PCB, I will attach flying leads and mount a three way switch on the podule blanking plate, with the correct wiring and switch, I’ve worked out that I can disable one, the other, or both clocks, giving me the ability to select 12, 20 or 24MHz. The best bit is that I wont have to keep dismantling my computer!

Stardot thread : https://stardot.org.uk/forums/viewtopic.php?f=16&t=21639

Using Smart Move on a Modern Computer

Using Smart Move on a Modern Computer

This page is a DRAFT as I do not currently have the correct hardware to fully test and debug the process. Feedback welcome, but do not rely on this being correct!

The Economatics Smart Box serial interface boxes used to come with a program called “Smart Move”. The software appears to have been available for a number of platforms (BBC Micro, RISCOS, MacOS and DOS), but I have only seen copies of the DOS software while searching. The software appears to load machine code directly into the memory of the Smart Box rather than sending serial commands. This is interesting as it goes some way to overcoming the speed limitations of the 9600 baud serial connection.

The following details my experiments in trying to get the DOS version of Smart Move running on a modern Linux computer, although most of the detail should also be applicable to other modern OSes. Note that the original DOS software will no longer natively run on Windows.

Step 1 – Get DOSBox

On Linux, DOSBox is installed from you packet manager of choice. If you’re using a Debian / Ubuntu style setup, you can just type “sudo apt install dosbox” at the command line.

Step 2 – Finding the Serial Port

If you don’t have a built in serial port (not many people do these days), you’ll need a USB to RS232 adapter. There are really cheap ones available, but just to warn you – I’ve been through two of the cheap ones that have a silver cable and blue plugs. I’d advise spending double the money and getting something that will last. I have one of these, which seems to be marginally better made.

On Linux, run the command “ls /dev/tty*” – this will list all available terminals (including serial ports). Now plug in your USB adapter, and run the same command again… an extra file should have appeared. This is your serial port. In my case, it is called “/dev/ttyUSB0”. If you’re using Windows, you’ll need to work out what COM port the device is connected as. Past experience on Windows says that sometimes you need to keep plugging into the same USB port to get the same COM port between sessions, but this might just be a permissions thing at work. On MacOS, the process for finding the name of the serial port is basically identical, except that the name of the port is usually a little bit different under MacOS.

Step 3 – Configuring DOSBox for Serial

Now that you have written down the exact name of your serial port (either something like “/dev/ttyUSB0” for Linux/MacOS, or “COM9” for Windows), open the DOSBox configuration file. On Linux, mine was located in “~/.doxbox/” and was called “dosbox-0.74-3.conf”. I opened it in nano to edit it by running “nano ~/.dosbox/dosbox-0.74-3.conf”.

Note that a foldername starting with “.” is an invisible folder on Linux. Additionally, it looks like the config file name will change depending on the version you have installed. The fastest way to open the file on Linux will be to type “nano ~/.dosbox/*.conf” and then press enter.

Details of where to find the config file on other platforms can be found here.

Within the now open config file, find the section titled “[serial]”. This can be done in nano by pressing “Ctrl-w”, typing “serial” and pressing enter. There are a load of examples / explanation lines which start with the “#” symbol indicating that they are comments. Scroll past these to where there are (in my file) for lines, each starting with “serial” and then a number. Modify the first of these lines, which starts with “serial1” to the following, substituting your own serial port (note on Linux, you do not need the “/dev/” as shown) :

serial1=directserial realport:ttyUSB0
serial2=dummy
serial3=disabled
serial4=disabled

Or perhaps on Windows :

serial1=directserial realport:COM9
serial2=dummy
serial3=disabled
serial4=disabled

Save and close the config file.

Get the Software

The following two downloads are the Smat Move DOS software for the Economatic Smart Box (“SmartV1-6”) and a DOS serial driver (“adf_150”). Both are needed to connect to the Smart Box.

The Smart Move software has kindly been made available here : http://flaxcottage.com/Oddments/default.asp – I have removed the “Finder.dat” file as this is a file added by MacOS and is not needed.

The driver comes from here : http://www.digsys.se/Obsolete/ADF.aspx.

Setup the Software

Extract the SmartV1-6 archive as a folder and store in a convenient location. You should now have a folder containing “SMART.EXE” and “AL.COD”. Create an additional folder called “Driver” within this first folder, and extract the contents of adf_150 into this folder.

Within the “Driver” folder, find the file “ADFCOM1.BAT”. Copy it, and name the copy “SBCOM1.BAT”. Open the file in a text editor. The contents should like like this :

@echo off
rem
rem Loading ADF for COM1
rem
rem    ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄCOM-port number, COM1-COM127.
rem    ³   ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄAddress in hex of COM-port, 0-FFFF.
rem    ³   ³  ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄIRQ number of COM-port, 0-15.
rem    ³   ³  ³      ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄLocked baud-rate, 1-115200.
rem    ³   ³  ³      ³     ÚÄÄÄÄÄÄÄÄÄÄSize of receive buffer, 256-16384.
rem    ³   ³  ³      ³     ³     ÚÄÄÄÄSize of transmit buffer, 256-16384.
rem    ³   ³  ³      ³     ³     ³  ÚÄReceiver FIFO trigger level, 1, 4, 8, 14.
rem    ³   ³  ³      ³     ³     ³  ³
adf COM1 3F8  4  57600  8192  8192  8
rem                        ³        ³
rem    ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ        ³
rem    ³               ÚÄÄÄÄÄÄÄÄÄÄÄÄÙ   Advanced options:
rem    ³               ³
rem 8192,7168,6144 16650,16,8    3  11
rem         ³    ³        ³ ³    ³   ³
rem         ³    ³        ³ ³    ³   ÀÄ Modem Control Register.
rem         ³    ³        ³ ³    ÀÄÄÄÄÄ Line Control Register.
rem         ³    ³        ³ ÀÄÄÄÄÄÄÄÄÄÄ 16650 Transmit FIFO trigger level:
rem         ³    ³        ³             8, 16, 24 or 30.
rem         ³    ³        ÀÄÄÄÄÄÄÄÄÄÄÄÄ 16650 Receive FIFO trigger level:
rem         ³    ³                      8, 16, 24 or 28.
rem         ³    ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Flow control continue or restart.
rem         ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Flow control hold or stop.
rem

Edit the line “adf COM1 3F8 4 57600 8192 8192 8”, replacing the number “57600” with “9600”. This is the serial baud rate (the speed of the connection). 57600 baud is way too fast for the Smart Box, which runs at 9600 baud. Save the changes and close the file.

As an aside, 9600 is 9600 bytes per second, plus one stop bit. If I remember correctly about this, this means that 9 bits are sent for every 8 bits of data, which is why technical people get irritated when you say 9600 bits/second instead of baud.

Run the Software

With the USB serial adapter connected, the Smart Box connected and the Smart Box powered on, launch DOSBox in the folder containing “SMART.EXE” (but don’t actually use it to run any specific program, we just want it to open at the command line). On linux this is done by navigating to the folder you want to start in in the terminal, then running “dosbox ./”. I can only assume it is the same under Windows, but I do not have any way of testing. Windows user can get a command line by typing “cmd” straight after opening the Start menu, and then pressing enter.

At the DOSBox command line, enter “cd DRIVER” to move into the Driver folder. Then enter “SBCOM1.BAT” to run the serial driver setup script we modified with a 9600 baud rate.

This should tell us “ADF loaded.” and dump us back at the command prompt.

Enter the command “cd ..” to return to the parent directory. The command “dir” shows us the files in this folder which should include “SMART.EXE”. Enter the command “SMART.EXE”.

At this point the Smart Move software is running. You should see “FOSSIL detected” showing that the serial driver is running and working with Smart Move.

Unfortunately, this is as far as I have got. The software sits at this point with a spinning progress glyph until it times out ages later. I am not yet sure if the issue is because I have the more modern SB-04 (this will surely cause issues as it must speak a different assembly language, and doesn’t have as much RAM as the older 6502 based variants?), or I have more software issues to solve. Hopefully this will be solved if either I get my hands on an SB-01, or someone else tests these instructions for me 🙂

Note the copyright notice names G.W.Babb – a name that is all over the internet, but I haven’t found any recent forum posts by him to ask for help tracking down the software. Gareth – if you’re still about, please get in touch with us as we’re trying to bring the Smart Boxes back to life and would love to know more about loading code into RAM and executing it!

Smart Box Analogue Sensor Types

Smart Box Analogue Sensor Types

Based on the responses from the “ReadSensorTable” command in my Economatics Smart Box SB-04, I’ve concluded that the following official sensor exist :

IndexNameVal1Val2Units
3Temp range 1TmpTempdegC
4Voltage range 1VVoltsmV
5Temp range 2TmpTempdegC
6Voltage range 2VVoltsvolts
7Temp range 3TmpTempdegC
8Voltage range 3VVoltsvolts
9Temp range 4TmpTempdegC
10Sound (standard)SndSound?
11pHpHpH?
13PositionPosPostndeg
17Light (standard)LtLight?
21R’HumidityHmdHumid%RH
22Sound range 1SndSounddbA
23Light range 1LtLightLux
24Sound range 2SndSounddbA
25Light range 2LtLightLux
26Barometric PressureAtmAtmosmBars
27Light range 3LtLightLux
28User adaptorUAUser?
290-1 Volt adapatorVAdapt?
30Temp (low range)TmpTempdegC
31Light gateLGLGate?
33Temp (standard)TmpTempdegC

There is more data being fed back by the box regarding these sensor types, but it is a little bit of a pig to understand as my terminal is reading it as escape characters. I suspect it would be easier to understand if I had some official sensors myself. I suspect that some experimentation is in order! I’ll connect a variable voltage to the detection pin and watch what sensor types the box detects at each voltage. With an ADC connected to my computer I might be able to automate the process… but that is probably more effort than it is worth.

Smart Box List of Commands

Smart Box List of Commands

Having got a copy of the Economatics Smart Box “Operating System Serial Protocols” document curiosity of John and flaxcottage.com, I noted that one of the commands returns the name of a command based on the provided command number. Given that the instruction manual is most likely for an older version of the Smart Box (mine is an “SB-04”, rather than the older “SB-01”), which is build around a 6502 processor rather than the Mitsubishi microcontroller in mine, I wrote a short program which iterates through every command number between 0 and 99 and returns the “CodeName”. The following table shows the resulting output – I’ve also included room for other Smart Box variants for when I get access to one, or if someone runs the same program for me.

Command No.SB-01SB-01/EVSB-04
0Blank*Blank
1VersionVersion
2ResetReset
3NameCodeNameCode
4CodeNameCodeName
5MultipleSetupMultipleSetup
6MultipleReadMultipleRead
7MultipleServerMultipleServer
8IdentSystem
9CreditsCredits
10WriteMotorsWriteMotors
11ReadMotorsReadMotors
12MotorForwardMotorForward
13MotorReverseMotorReverse
14MotorHaltMotorHalt
15MotorPowerMotorPower
16PatchMF*PatchMF
17MotorVoltage
20WriteOutputsWriteOutputs
21OutputPowerOutputPower
22GetSensors*GetSensors
23CheckSensors*CheckSensors
25ReadSensorTable
28SetBitHighSetBitHigh
29SetBitLowSetBitLow
30ReadADCReg*
31WriteADCReg*
32ReadACIAReg*
33WriteACIAReg*
34ReadVIAReg*
35WriteVIAReg*
36SetVIAHigh*
37SetVIALow*
40ReadADCReadADC
41ReadADCsReadADCs
42ForcedADCReadForcedADCRead
44HighResADCHighResADC
45LowResADCLowResADC
47ReadResolutionReadResolution
50DownloadDataDownloadData375
52UploadDataUploadData375
54ExecuteCodeExecuteCode375
55StoreByteStoreByte375
56ReadByteReadByte375
57ReadRAMSize
59ExtendCall
60SetClockSetClock
61ReadClockReadClock
62ReadTopmem
63WriteTopmem
64ReadLomem
65WriteLomem
66ReadHimem
67WriteHimem
90ReadInputsReadInputs
91ReadBitReadBit
92ReadOutputs
93CountReset
94CountRead

Items marked with a * in the SB-01 column are undocumented. The SB-01 commands were taken from a machine belonging to mph1708 on the stardot.org.uk forums. The machine was running ROM OS 2.073 dated 12/07/96.

The program I used is as follows – don’t forget to change the serial port from “/dev/ttyUSB0” to whatever is applicable on your setup :

#!/usr/bin/python
import time
import serial

ser = None

def getCommandName(cmd):
        global ser
        if ser.is_open:
                ser.write(chr(4)+chr(cmd))
                time.sleep(0.2)
                readText = ""
                while ser.inWaiting() > 0:
                        readText += ser.read(1)
        return readText

ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)

x=0
while x<100:
	theText = getCommandName(x)
	if len(theText)>1:
		print str(x)+" : "+theText
	x+=1

ser.close()

Please let me know if you have any interesting results via my contact page.

Things to note looking at the results, compared to the available documentation…

  • Command 0 (Blank) is undocumented
  • Command 8 (IdentSystem) is undocumented
  • Command 9 is called “Credits” instead of “Copyright”
  • The documentation contains both “MotorHalt” and “MotorPower” (an typo?) as Command 14. The SB-04 box reports Command 14 as “MotorHalt” and Command 15 as “MotorPower”
  • Command 16 (PatchMF) is undocumented
  • Command 17 (MotorVoltage) is undocumented – this is not a surprise as some older Smart Boxes used a key to change voltages, whereas it seems that this is a software feature on the SB-04
  • Command 22 (GetSensors) is undocumented. I assume this reports what sensor types are connected?
  • Command 23 (CheckSensors) is undocumented
  • Command 25 (ReadSensorTable) is undocumented
  • The documentation contains both “SetBitHigh” and “SetBitLow” (an typo?) as Command 28. The SB-04 box reports Command 28 as “SetBitHigh” and Command 29 as “SetBitLow”
  • Command 43 is not present on the SB-04. This is “ReadSensor” and may have been replaced by Command 22, 23, and 25
  • Commands 50, 52, 54, 55 and 56, all of which relate to accessing the Smart Box memory and executing the contents of the memory, have been renamed with “375” on the end. I believe this refers to the microcontroller type? I am surprised to see they are still implemented at all.
  • Commands 51 and 53 have been omitted. These commands related to transferring data to and from the Smart Box using an Xmodem transfer format (with and without error checking)
  • Command 57 has been omitted (ReadRAMSize)
  • Command 58 has been omitted (ReadModule). This command seems to be for identifying some kind of hardware additions fitted to the equipment when the Smart Box was used embedded within a machine or similar.
  • Command 59 has been omitted (ExtendCall) this seems to be a method by which additional commands could be added and it seems unfortunate that it has been excluded. Reference is made to “Appendix B, machine code programming”. Unfortunately I don’t appear to have a copy of this appendix.
  • Command 62 is omitted (ReadTopMem)
  • Command 63 is omitted (WriteTopMem)
  • 64, 65, 66 and 67 (“ReadLoMem”, “WriteLowMem”, “ReadHiMem” and “WriteHiMem” respectively) are all omitted
  • Command 93 (CountReset) is undocumented. I guess this is a hardware counter, but don’t currently know what input it is connected to.
  • Command 94 (CountRead) is undocumented. I guess this is a hardware counter, but don’t currently know what input it is connected to.

I’d be very interested to run the same program on an older Smart Box to see if there are any undocumented commands there. A fair few commands appear to have been removed for the SB-04, many of which were likely difficult or impossible to implement on the microcontroller as opposed to the full 6502 embedded computer that existed before.

Working with the Economatics Smart Box Serial Interface on a Modern Computer

Working with the Economatics Smart Box Serial Interface on a Modern Computer

Well, I had all sorts of fancy plans for how I would reverse engineer the serial protocol to control my ebay purchase “Smart Box” (some of which I will document at some point as they’re useful). Ultimately, I had so much difficulty installing MS .net 1.1 in Wine / PlayOnLinux that I went back to trawling the internet looking for alternative software to wire tap.

Smart Box
Smart Box

I struck gold when I found the following website :

http://old.ftcommunity.de/ftComputingFinis/smartboxe.html

The website includes a download of example code, the core of which is in VB6 and includes many serial commands for controlling the Smart Box (SB-04 version – I understand that older versions work differently, so be warned!), as well as an instruction manual that goes some way to explaining how the box data formats work.

After a bit of messing about in Python, it was fairly trivial to test a number of commands and witness the results. The only major feature I’m not currently sure about is the Analogue Inputs – I don’t know what the pinout is of the 5 pin DIN sockets, and so can’t easily test them. Perhaps a bit of circuit board investigation will help with this.

In summary, I have found the following :

DescriptionCommandParameterResponsePython Example
Set All Motors108 bit value. Note, each pair of bits represents a motor. 01=left, 10=right and 00=stopn/aser.write(chr(10)+chr(0b01010101)) # rotate all motors to the left
Motor <x> Left121 to 4n/aser.write(chr(12)+chr(1)) # rotate motor ‘A’ to the left
Motor <x> Right131 to 4n/aser.write(chr(13)+chr(1)) # rotate motor ‘A’ to the right
Motor <x> Stop141 to 4n/aser.write(chr(14)+chr(1)) # stop motor ‘A’
Set All Digital Outputs208 bit valuen/aser.write(chr(20)+chr(0b11111111)) # turn all digital outputs on
Get Analogue <x>40 (TBC)1 to 48 bit value??ser.write(chr(40)+chr(1)) # send me analogue input ‘A’
Set Low Resolution Analogue45 (TBC)n/an/aser.write(chr(45)) # set low resolution analogue mode
Get All Digital Inputs90n/a8 bit value. Note the command seems to respond with three bytes, although the first identifies the status of each input.ser.write(chr(90)) # send me the status of the digital inputs
Get Digital Input <x>91 (TBC)1 to 80 or 1 (in 8 bit value)ser.write(chr(45)+chr(1)) # send me the status of digital input 0

The following example switches on motor ‘A’ for 5 seconds, stops it for 0.5 seconds, runs it backwards for 2 seconds and then stops it. Note the serial port will need setting – I have used ‘/dev/ttyUSB0’ as this is the correct port for my USB to RS232 adapter on my Linux machine.

#!/usr/bin/python

# https://elephantandchicken.co.uk/stuffandnonsense
# 04/03/2020

import time
import serial

# This example tests motor output A

ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)

ser.write(chr(12)+chr(1))
time.sleep(5)
ser.write(chr(14)+chr(1))
time.sleep(0.5)
ser.write(chr(13)+chr(1))
time.sleep(2)
ser.write(chr(14)+chr(1))

ser.close()

The following example reads the status of all digital inputs (aka “Digital Sensors”) 20 times.

#!/usr/bin/python

# https://elephantandchicken.co.uk/stuffandnonsense
# 04/03/2020

import time
import serial

# This example reads in the digital sensors and displays their status

ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)

# Flash Digital Outputs to show that the program is running
ser.write(chr(20)+chr(255)) # all on
time.sleep(0.1)
ser.write(chr(20)+chr(0)) # all off
time.sleep(0.1)

i = 0

while i < 20:
	ser.write(chr(90)+chr(1)) # request digital input status
	time.sleep(1) # wait (ages) for the response
	readVal = 0 # clear variables
	readByte = 0
	readByte = ord(ser.read(1)) # read the first waiting byte in the buffer
	while ser.inWaiting() > 0: # if there is more data in the buffer
		readVal = ord(ser.read(1)) # read it to clear it
	print "result : ",format(readByte, '08b') # print the first byte in boolean format
	i+=1 # increment counter for the while loop
ser.close()

I still have some more work to do, regarding confirming exactly how these commands work (for example, what are the second and third bytes from the digital read response?). Additionally, I suspect that it is possible to set the voltages, but don’t know how. I’m (absolutely) guessing that command 11 might be motor speed.

Additionally, please contact me if you know any more details of the control scheme, or the analogue port pinout.

Economatics Smart Box

Economatics Smart Box

A little while ago, I bought myself a Economatics Smart Box (SB-04). My intention is to reverse engineer the serial protocol so that I can use it from a modern (Linux, but the information will be useful to others) computer. These boxes were common in schools in the UK through the 90s (and possibly before). Older variants worked with the BBC Micro. This is what they look like if anyone has forgotten or hasn’t seen one before :

Image

A couple of minor issues so far – Number 1 – This specific model (the SB-04) doesn’t have mains in like some of the older versions, it has 12v AC in – don’t know about you, but I’ve hardly seen any AC-AC PSUs in years.

I’m aware that often you can just use a DC PSU of the same voltage with such equipment because the first thing that happens on the circuit board is that the supply is rectified and smoothed… using a DC supply just means that the supply is always going through two of the diodes and the capacitor remains permanently charged. As long as you’re within the diode ratings and the resultant voltage is close enough, there isn’t an issue. My thought was to check the circuit and see if there was any obvious reason why this wouldn’t work, which is where we get to issue Number 2…

Anti-tamper screws. I managed to get these out using a tiny socket and pushing down hard.

Lovely looking PCB inside designed by “G A Assembly Ltd” and “Mindstorm” (I wonder if there is any connection to the Lego Mindstorm?). Note one bodge wire, a socketed chip with the firmware version (with an unusual pitch), a missing MAX4622 chip (single pole double throw fast acting switch https://www.maximintegrated.com/en/prod … X4622.html) and space for a USB B socket. The digital outputs are buffered with ULN2064b chips (these are darlington pair arrays).

Anyway, I’ve got distracted.

First point – there is no obvious rectifier, the PSU portion of the circuit is complex and includes two large inductors by the look of it. I’ll have to do a bit more digging and look up what some of the components are.

Second most important point – does anybody have a photo of the USB version of this board – I’d be interested in adding USB if I can. Current theory – the bodge wire is hardwiring my board to Serial and saving the need for the MAX4622 chip for switching between USB and RS232. There are a bank of jumpers that look interested and are next to the USB lines. I’m also wondering is the firmware the same in the USB and Serial variants?

Photos of the top side of the PCB (actually the bottom as it sits on the desk) for interest.

Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image

I think the main chip might be some kind of 6502 based MCU or similar – I can’t find a good datasheet online that exactly matches. It has a reduced pin pitch, 42 pins and it looks like the Crystal is connected to pins 19 and 20.

A 6502 based MCU would make sense given that the company made BBC Micro peripherals.

Older versions of the board are basically an embedded 6502 computer with RAM, ROM, an ADC and a VIA. My newer version is based on a Mitsubishi microcontroller, the M37536E8SP.

I’ve taken the board completely out of the case now. No components on the reverse, but useful for tracking traces. I’ve also noticed that there is a cut trace next to the test point that the bodge wire is attached to (separating it from a capacitor that looks like it is attached to a power rail judging by the track width – they must have accidentally tied it high).

Underside of the PCB :

Image

Thoughts welcome, photos of the USB variant would be gratefully received!

___________________________________________________________________

Update – Some progress. I have digital write working from Python. I was lucky enough to find this page, which includes a download of sample code for controlling the Smart Box from VB6. Helpfully, this includes a number of the serial commands for making the box do various things. I’ve been able to extract the commands for the core functionality.

Programming a TMM27128D with the TL866 EPROM Programmer

Although the TMM27128D (Toshiba) UV Erasable EPROM is not listed within the menus of the Xgpro software for the LT866ii Plus EPROM Programmer, I found that I was able to program a blank chip by selecting (AMD) AM27128A, unchecking the “Check ID” box, set VDD write to 5V and adjusting the VPP voltage to the maximum 18V. Note 18V is a little lower than the specified 21V, so while it worked and passed verification, it might not be the best solution. Good if you’re stuck in a fix though.

BeebEm and Marathon in RetroPie

I’ve been setting up an SD card for my Raspberry Pi 2 with the latest stable version of RetroPie. RetroPie is a collection of emulators presented from a single interface that can be navigated easily with a controller. BeebEm is a BBC Micro emulator, and is not included as standard in RetroPie.

As I, and several of my friends grew up with BBCs, I decided that this needed sorting and so following these instructions, I was up and running in no time. I also added Marathon 2 and Marathon Infinity into the “Ports” section, using the method shown here. This second method is a lot simpler, but is only really suited to single games, rather than whole platforms with multiple games. For some reason, the original Marathon game did not work properly (loaded, but would not enter a game). I will return to look at it another time.

For those who do not know, the Marathon games were a series of games produced by Bungie in the 1990s (after Pathways into Darkness and Gnop, before Oni and Halo, at a similar time to the Myth series!). The games were fun to play, good to look at and had well written story lines. A rare thing at the time. Just before Microsoft bought Bungie, they kindly released the source to the Marathon engine and so a community project (called Aleph One)was born to update it and port it to new platforms. This is how, years down the line, I am able to play the games on a computer the size of a pack of cards, running on a processor derived from the follow on of the BBC Micro, using an operating system that it was never released for.

Marathon Infinity
Playing Marathon Infinity on the Raspberry Pi