UK Vintage Radio Repair and Restoration Powered By Google Custom Search Vintage Radio and TV Service Data

Go Back   UK Vintage Radio Repair and Restoration Discussion Forum > Specific Vintage Equipment > Vintage Computers

Notices

Vintage Computers Any vintage computer systems, calculators, video games etc., but with an emphasis on 1980s and earlier equipment.

Closed Thread
 
Thread Tools
Old 30th Jan 2021, 6:23 pm   #1
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,485
Default Yet another (Arduino) MK14 uploader

Yes, yet another uploader to relieve you of the historic chore of typing code into the MK14.

My original MK14 uploader is here:-

https://www.vintage-radio.net/forum/...ad.php?t=92999

Its successor, using a simplified optocoupler interface and powered by a late model Raspberry Pi, is here:-

https://www.vintage-radio.net/forum/...d.php?t=151851

.. and seen working here:-

https://www.youtube.com/watch?v=-AXgyeH0F2E

That version was then forked / converted by DeltaAlpha52 to an Arduino version here.

https://www.vintage-radio.net/forum/...69#post1260769

Elsewhere, there was an interesting and entirely different version devised by Milan Humpolik in this foreign language forum thread here -

http://oldcomp.cz/viewtopic.php?f=89...e03640724a0bac

- your browser will no doubt offer to translate it for you. Milan's uses the direct 'sense and react' method to interface with the MK14 and because it has that direct connection to the keypad hardware it can also do what none of these other uploaders do, it can read keypresses and store them, so it is able to act as a keypress recorder / player. Quite an interesting read.

Just for fun, there is also this uploader - a bit slower than any of the others but closer to the original concept than any of the rest.

https://robdobson.com/2016/10/mk14-meets-7bot/

After all those, why another Arduino version when there is already an Arduino version and several other versions?

The difference is that this one takes in Intel Hex transmitted to it from the serial port on any host which can recognise the Arduino as a USB serial port device, so rather than having a host specific companion program or script on the host, the host just needs to have a native terminal program capable of loading and sending a text file. Conversion of the Intel Hex file to MK14 input keypresses is now done on board the Arduino. On some OSes you may just be able to CAT or COPY a hex file straight to a COM port at the command line. This is essentially a relaunch of the original PIC based Serial Hex uploader, but now using a readily available pre-built micro PCB and a simpler opto interface, and a USB serial connection rather than RS232.

As always, there are two versions of the optocoupler interface to the MK14. Which one you build depends on whether you are using an original MK14 / Czech Issue V replica / Slothie Issue VI on one hand, or on the other hand, a JM Precision replica which has its own distinct keypad connector connection layout. As well as the obvious differences at the left side of the circuit diagram, note that the connections to Arduino pins 8 and 9 on the right hand side are also swapped over on the version for the JMP replica.

The other main circuit addition is a 5V-friendly Microchip 23LCV512 SPI SRAM which serves as a very big buffer into which the interface quickly downloads the whole hex file before working through it and sending it out to the MK14 as key presses. At the time of writing these SRAM devices are very cheap, typically £2-£3.

With the addition of this IC the output controlling the MK14 Reset opto, originally Arduino pin 10 in DA52's project, has now been moved to Arduino pin A5. Pin 10, traditionally used as SPI _CE when the SPI interface is used, is now used for that purpose.

As you can see from the attached images it is not too difficult to build the interface circuit on a 'Shield Prototype' PCB for the Arduino UNO. I used surface-mount versions of the TLP185 optocouplers and surface-mount resistors in order to pack everything into a small area. The opto LED series resistors are on the underside of the shield PCB along with all the (messy) interwiring. If the interface is only to be used with one of Slothie's 'issue VI' replicas the output from the reset opto can go to the top two fingers on the keypad edge connector. As I also have a real MK14, I have instead brought those connections out to mini test clips which can be attached to the leads of the reset capacitor, regardless of which version of MK14 the interface is driving. If building the interface in this compact form looks daunting you can always build the opto interface on a bit of stripboard and make the layout a one to one copy of the circuit diagram, as I did with the Pi version.

Usage is very straightforward, connect it to the MK14 keypad connector, connect the Arduino to a USB port on the host PC, load up a terminal program on the host PC, set it for 115200-N-8-1 and whichever COM port the Arduino is on, and use the terminal program to load and send (as ASCII) an Intel Hex file to the MK14. The high serial baud rate and the relatively small (kilobytes) size of typical MK14 hex files makes the serial download to the Arduino seem almost instant. When sending to an MK14 with the new OS, the 'Message' program takes several seconds from initial download to upload into to the MK14 and run. The old OS requires five keypresses per data byte entry as against three for the new OS, so it is noticeably slower (but still much quicker than typing it in).

As with earlier versions of the uploaders there are certain features and limitations:

-Can only upload Intel Hex files

-No need to tell the MK14 where to put the code - the uploader will enter it into the addresses contained in the hex file. However there are no checks as to whether the memory areas addressed in the hex file are valid addresses in an MK14 - it's up to you to make sure they are by placing ORG statements in your source code. There is also no real limit on the amount of code which can be uploaded in one go, subject to your system having physical memory for the code to go into of course.

-The interface allows for both versions of the MK14 OS, the original one with the '---- --' prompt and the 'New' OS with the '0000 00' prompt, which require different sequences of keypresses to enter code into the MK14. This aspect is controlled by the state of Arduino pin A4 - leave it open / unconnected if your target machine has the 'new' OS. Connect it to Arduino GND via a low value resistor (330R) if the target system has the 'Old' OS. Although a plain link to GND would also work, a resistor will protect the A4 pin in the event that it ever gets set to an output, for example by loading a different sketch into the Arduino with the MK14 interface still mounted.

-If you include the 13th (Reset) opto in the interface and connect its output to the reset capacitor on the MK14 (or reset input on an issue VI) the uploader will reset the MK14 to force it back to the monitor so it can upload to the machine even if it is already running a program.

-The uploader will automatically run a program after uploading it if you place the execution address in two bytes, high byte, low byte, at addresses FFFE and FFFF in the hex file, by putting a statement like this at the end of your source code:

ORG 0xFFFE
DB 0x0F ;Example - Execution address of 0F12
DB 0x12

(The exact syntax will depend on your Assembler). If you use something like...

DEFW 0x0F12

...to generate a word of data, your assembler might store the bytes in reverse order in the generated file so unless you can force it not to do that, it's best to define the bytes of the execution address in the correct highbyte-lowbyte order separately, as per the example above.

The last two features make for a nice hands-off development system as you can continually modify and upload and run code without having to touch the MK14, unless of course the program you are developing needs user input via the keypad.

Memory location 0FFF, the last byte of 'standard' memory, requires special handling when using this or any of the other keypad injection uploaders which work by 'typing' the code in through the keypad edge connector. It is a feature of the MK14 monitor that any data manually (or automatically) typed into this address is copied to the SC/MP status register, and because some bits of that register control the state of the hardware output flags, the states of the flag outputs will also be changed. To avoid this, if your code must use location 0FFF, have the uploader load the byte destined for 0FFF into some other RAM location (I/O RAM?) and then have your code copy that byte from its temporary location to 0FFF once control of the system has been handed over from the monitor to your code.

I'm still tapping the wheels on the Arduino sketch which powers this, but I should be able to post it here some time in the next few days.
Attached Thumbnails
Click image for larger version

Name:	MK14_Arduino_Serial_Uploader_Top.jpg
Views:	125
Size:	127.1 KB
ID:	225601   Click image for larger version

Name:	MK14_Arduino_Serial_Uploader_Below.jpg
Views:	102
Size:	135.2 KB
ID:	225602   Click image for larger version

Name:	MK14_Arduino_Serial_Uploader_Complete.jpg
Views:	114
Size:	95.9 KB
ID:	225603   Click image for larger version

Name:	MK14_Serial_Arduino_Interface_V1.0.jpg
Views:	101
Size:	43.4 KB
ID:	225604   Click image for larger version

Name:	MK14_Serial_Arduino_Interface_JMP_V1.0.jpg
Views:	87
Size:	43.0 KB
ID:	225605  

SiriusHardware is offline  
Old 1st Feb 2021, 6:26 pm   #2
Slothie
Octode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 1,287
Default Re: Yet another (Arduino) MK14 uploader

Well this is timely, it'll save me the time of rounding up the forum threads. looks very neat!
Slothie is offline  
Old 2nd Feb 2021, 10:15 pm   #3
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,485
Default Re: Yet another (Arduino) MK14 uploader

Here's the rest of the project. In the attached zip file you have:

-MK14_key14_V1.0b.ino - opto interface testing 'sketch' (program).

-Serial_MK14.ino - the uploader sketch.

-Larger versions of the circuit diagrams in post #1.

-The 'Message' and 'Moon Landing' hex files, to get you started. In this instance they have .txt extensions to make them easier for the 'ASCII Send' feature of your terminal program to browse to, but they are still Intel Hex files. Both have the execution address embedded in them so that the uploader will auto-run them after upload.

The first of the two Arduino sketches was 99.9% written by DeltaAlpha52 - this modified version has very minor changes to suit this version of the interface. Use it for single key testing / troubleshooting of this project's optocoupler interface - pressing the G, M, T, 0-9 and A-F keys on your terminal keyboard (upper or lower case) strikes the equivalent keys Go, Mem, Term, 0-9 and A-F on the MK14. For 'Abort', use 'Q' (because 'A' is already used). Pressing 'R' should reset the MK14. The serial port settings in this modified version are 115200 - N - 8 - 1, to match those of the uploader.

The uploader sketch outputs a 'Ready' prompt and waits for you to send an Intel Hex file to it by using the 'Send Text file' or 'Send ASCII File' feature of your terminal program. It operates in a two-stage fashion, first it downloads the whole Intel Hex file into the SRAM, which at 115200bd happens quite quickly. Beyond checking that the first character of the file is ':', no further file format checks are carried out at that stage, the file is just downloaded into SRAM as fast as possible.

Then, the uploader works through the Intel Hex file line by line and outputs the code as keypad keypresses. If any line of the downloaded file fails a checksum check the upload to the MK14 will be aborted, otherwise the uploading process continues until the whole Intel Hex file has been processed and sent to the MK14.

After upload, the interface goes back to the 'Ready' prompt and waits for you to send another Intel Hex file.

As mentioned earlier, the state of Arduino pin A4 sets the OS loading mode of the uploader. If left open / unconnected, the uploader sends the key presses required by the 'new' OS. If A4 is taken low via a low value resistor, the uploader sends keypresses in the sequence required by the 'old' OS. I have tested the uploader with both OS versions.
Attached Files
File Type: zip MK14_Serial_Arduino_Loader.zip (425.6 KB, 60 views)
SiriusHardware is offline  
Closed Thread

Thread Tools



All times are GMT +1. The time now is 2:26 pm.


All information and advice on this forum is subject to the WARNING AND DISCLAIMER located at https://www.vintage-radio.net/rules.html.
Failure to heed this warning may result in death or serious injury to yourself and/or others.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright ©2002 - 2023, Paul Stenning.