UK Vintage Radio Repair and Restoration Powered By Google Custom Search Vintage Radio 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.

Reply
 
Thread Tools
Old 12th Apr 2020, 7:51 pm   #1
DeltaAlpha52
Triode
 
Join Date: Feb 2020
Location: Crawley, West Sussex, UK.
Posts: 29
Default MK14 programming interface - Arduino version

Hi all

Attached is a programming interface for the MK14 based on using an Arduino UNO and a Python script running on linux or windows. I have added the Moonland.hex file wrapped in a zip file.

It's based on the one described in the thread
https://www.vintage-radio.net/forum/...d.php?t=151851

This one works on my MK14 using the original SCIOS system that starts with ---- --, you will need to change the python script if you have the later version that starts with 0s.

Hopefully it can be improved, certainly the speed is not optimised but does work.
Attached Files
File Type: zip key_14_arduino.zip (6.1 KB, 25 views)
File Type: zip moonland.zip (465 Bytes, 21 views)
DeltaAlpha52 is offline   Reply With Quote
Old 12th Apr 2020, 8:55 pm   #2
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

I can contribute these, which were originally optocoupler interface diagrams for the Pi powered version, now annotated with the details of the connections to the Arduino Uno and Arduino Mega256. The pin numbering on these diagrams is based on the details contained in the .ino sketch in the first post above.

The first diagram is the one to use if you have either an original MK14 or one of the Czech replicas which seem to be perfect clones of the issue V MK14.

If you have one of the JM Precision replica PCBs you will need to build the interface as per the second diagram.
Attached Thumbnails
Click image for larger version

Name:	MK14_Arduino_Interface_V1.0.jpg
Views:	53
Size:	65.3 KB
ID:	202854   Click image for larger version

Name:	MK14_Arduino_Interface_JMP_V1.1.jpg
Views:	44
Size:	66.7 KB
ID:	202855  
SiriusHardware is offline   Reply With Quote
Old 13th Apr 2020, 12:43 am   #3
DeltaAlpha52
Triode
 
Join Date: Feb 2020
Location: Crawley, West Sussex, UK.
Posts: 29
Default Re: MK14 programming interface - Arduino version

I meant to say in the first post that The MK14_key14.ino is the script for the Arduino to be loaded via the standard IDE. It is set to use the Uno. It can be tested using the serial monitor provided by the IDE and you can send the key values to the Ardunio. It will echo them back, and hopefully the MK14 will respond. If you send an x to the arduino it will then respond with what pins it is turning low for each key value you send it.

The send14Arduino.py is a python3 script to send a .hex file to the arduino, as a set of key values, using the serial port. Although python works in both windows and linux you do need to amend the script to use the specific port that your arduino is on. It is set for the 'old' MK14 OS. You can call it using

python3 send14Arduino.py moonland.hex

My thanks to SiriusHardware for the updated interface diagrams.
DeltaAlpha52 is offline   Reply With Quote
Old 13th Apr 2020, 11:52 am   #4
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

When I first ran the Python uploader script on my Linux netbook it came up with an error along the lines of 'Can't import module: serial'. This was not caused by any sort of failing or oversight in the project, but rather in Python, which does not seem to have native support for serial in/out.

I found I had to separately install the 'pyserial' add on for Python to get past this error. It can be found here, along with instructions for how to add it to an already existing Python3 installation.

https://pypi.org/project/pyserial/

Be aware that if you have both Python 2 and Python 3 installed then the simplest way of installing pyserial in Linux,

Code:
pip install pyserial
will tend to install it in Python 2, not Python 3 - that's what happened to me. I had to follow the more detailed instructions, downloading the pyserial package, unpacking it to a known location and running the 'setup.py' install file with

Code:
python3 setup.py install
rather than

Code:
python setup.py install
..which would install it in Python 2.

Installation of pyserial for Python for Windows will require its own procedure, I refer you to the website above for further details.
SiriusHardware is offline   Reply With Quote
Old 13th Apr 2020, 11:59 am   #5
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

Quote:
Originally Posted by DeltaAlpha52 View Post

This one works on my MK14 using the original SCIOS system that starts with ---- --, you will need to change the python script if you have the later version that starts with 0s.
Specifically, locate the line, early in the script,

Code:
MK14_OS = 0
and change it to

Code:
MK14_OS = 1
If your MK14 has the 'new' OS with the zeros prompt at reset.
SiriusHardware is offline   Reply With Quote
Old 18th Jun 2020, 7:54 pm   #6
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

I like the Raspberry Pi version of this uploader for the fact that it can be used as a one-stop development station - as it has a keyboard and screen and is a 'proper' computer you can run a text editor and an assembler on it as well as the uploader.

However, there are times when you just want to upload some already prepared code to the MK14 and this is where the Arduino version can be handier because it doesn't need the entire support package that a Pi does (TV or monitor, keyboard, mouse, screen, PSU) and it can be driven from something like a small Windows or Linux netbook which is a bit quicker to set up.

After testing out the Arduino version initially by connecting the Arduino to the already existing opto-interface of the Pi version, I have now built the same opto interface onto a an Arduino Uno 'shield prototype' PCB. (See attached). The nice thing about 'pad board' as opposed to stripboard is that it allows quite a high density of component packing. It doesn't look quite as neat underneath, where all the interwiring is.

There are a couple of minor differences from the original one on mine, one is that I have moved the 'reset' output from Arduino pin 10 to previously unused Arduino pin A5 and I have altered one line in the Arduino sketch to reflect this change.

The other is that I have installed a 23LCV512 SPI serial SRAM chip on the interface, connected to Arduino pins 10, 11, 12, 13 (and to 5v power). This is currently unused but will be used to allow high speed serial download of an entire Intel hex file onto the interface- once fully received the Arduino will then work through the received Intel Hex file, outputting it as key presses to the MK14. This will remove the need for a host-specific program on the sending system, all that will be needed is a standard terminal program capable of sending ASCII files out over a serial port, or you can even CAT / Copy the hex file to the serial port via command line if your OS supports it.

So far I have Arduino code which downloads an incoming file and then retransmits it back out for comparison, both at 115,200bd which for a typical MK14 Intel Hex file only takes a very short time to download into the SRAM. The next job is to move the software which trawls through the hex file and converts it to MK14 key presses off the host / sending system, and onto the Arduino.
Attached Thumbnails
Click image for larger version

Name:	MK14_Arduino_Uploader.jpg
Views:	80
Size:	79.9 KB
ID:	208833  
SiriusHardware is offline   Reply With Quote
Old 18th Jun 2020, 9:50 pm   #7
Slothie
Heptode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 528
Default Re: MK14 programming interface - Arduino version

Last year I was considering a similar idea using an arduino, display and SD card to store hex files on that would be standalone, which would be handy for demos and much loved games. I have a Pi Zero W based one almost working however because I like the development system use as Sirius pointed out. Being WiFi its easy to connect a laptop to as well.
Slothie is offline   Reply With Quote
Old 18th Jun 2020, 11:02 pm   #8
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

I believe Martin L already did something along the lines you suggest (Arduino, display, SD card) but the output from his emulates the cassette data stream, which imposes several limitations. I don't know if he made that project public but if he did maybe you could marry that code to the Arduino code here to create a version which uploads via the keypad edge connector.

I did think about a 'retro' way of doing this as well, a way that could have been implemented using parts and methods which were available when the MK14 was your only 'computer'.

If you take a clock pulse generator, feed that to a 16-bit upcounter, and feed the outputs from that to the address pins of an EPROM, there you have a system which will output a series of programmed patterns in sequence.

An EPROM only has 8 bits per location, not enough to directly drive the 4 row optocouplers and 8 column optocouplers of our now standard interface. You could parallel up the address inputs of a second EPROM with the first, and now one holds the bit patterns to control the four row optocouplers and the second the bit patterns to control the eight column optocouplers. EPROMs don't usually have very strong drive capabilities so you'd need to buffer the data outputs to drive the opto LEDs.

Alternatively stick with one EPROM (because they were very expensive back in the day) and use bits 0-2 and bits 4-6 in each EPROM location to select the rows and columns to connect together via an interface using two back to back 4051 'digital rotary switches'. (See attached diagram).

In this scheme the clock going to the upcounter input would also go to the commoned 4051 EN inputs so that the selected row and column would be connected for half of each clock cycle, giving a key release period between each key press.

The code held in each location defines a key press, so you could even implement auto run by programming the last few bytes to press 'Abort' '0' 'F' '1' '2' 'Go'

The unused two data bits (3, 7) in each location could be used for control functions, eg, bit 7 could be directly connected back to the 'inhibit' input on the upcounter to halt it once all key presses have been sent.

Of course, all this presupposes that you must have had access to a stand-alone EPROM programmer with an integral keypad and display - something like a SOFTY.
Attached Thumbnails
Click image for larger version

Name:	twin4051s.jpg
Views:	32
Size:	31.9 KB
ID:	208847  
SiriusHardware is offline   Reply With Quote
Old 18th Jun 2020, 11:07 pm   #9
Slothie
Heptode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 528
Default Re: MK14 programming interface - Arduino version

Another option: Arduino asserts NENIN and writes directly to RAM. Could also have read access to save memory !
Slothie is offline   Reply With Quote
Old 18th Jun 2020, 11:08 pm   #10
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

Yep, and so much easier to do on your issue VI PCB than any other. Wouldn't give you the control you'd need to auto-run the code so you would have to do that manually. Upload would be near-instantaneous.
SiriusHardware is offline   Reply With Quote
Old 7th Aug 2020, 12:42 am   #11
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

I've just discovered a pretty bad bug in the send14 script - when attempting to load an Intel Hex line which happens to have a checksum byte with the value of '00', the uploader will fail to load it claiming (incorrectly) that the line checksum is bad.

I'll post a fixed version of the Arduino version script here and the Pi version in the currently closed Pi-uploader thread if I can get it re-opened, but in the meantime here is the bug - (image # 1) - the two lines indicated are in the wrong order. Swap them around as per image #2 and save the modified script, that will fix the problem.

Astonishing that this problem has not come to light long before now, sorry about that.
Attached Thumbnails
Click image for larger version

Name:	send14_checksum_bug.jpg
Views:	32
Size:	52.2 KB
ID:	212884   Click image for larger version

Name:	send14_checksum_bug_fixed.jpg
Views:	25
Size:	41.6 KB
ID:	212885  
SiriusHardware is offline   Reply With Quote
Old 11th Aug 2020, 8:21 pm   #12
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

As detailed above there was a bug in the send14.py script in the .zip file attached to the first post in this thread. This bug was present in my original script for the Pi version and was carried over into this version.

I have attached the fixed version of the PC-side python script 'send14.py' wrapped up in a .zip file along with the .ino file which runs the Arduino end of things (unchanged) and the moonland.hex program file to give you something to upload 'out of the box' as per the original post.

If you already have things up and running you can just fix your existing script by making a minor edit as per the previous post.
Attached Files
File Type: zip send14_For_Arduino.zip (6.5 KB, 13 views)
SiriusHardware is offline   Reply With Quote
Old 6th Oct 2020, 2:41 pm   #13
DeltaAlpha52
Triode
 
Join Date: Feb 2020
Location: Crawley, West Sussex, UK.
Posts: 29
Default Re: MK14 programming interface - Arduino version

Whoops - that was a bit of a silly error Feel I should have spotted that but not had any code that caused the error.

What was the code that showed the problem?
DeltaAlpha52 is offline   Reply With Quote
Old 6th Oct 2020, 6:12 pm   #14
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

Hi DA52, nice to see some activity from you. These are worrying times and we can't help but wonder about anyone we don't hear from for a while.

Yes, it was quite an embarrassing mistake. The code file which eventually tripped it up was an image file that I had created myself, I suppose most people would be using it to load programs resurrected from the MK14 manual but I'm still amazed it took so long to show up.

I still have plans to make a more 'universal' version of your Arduino based uploader, one which can take in serial Intel Hex from any source which can send Intel Hex out over a serial connection, and doesn't require a specific companion program or script on the host.

To do that though, I've decided to use a serial SRAM as the RS232 input buffer so that the interface can receive the entire Intel Hex file at a very high serial speed and store it while the uploader works its way through it, translating it into key presses.

I'm actually tending to use my hardware build of your (Arduino) version of the uploader more than I do my Pi version, because I can use my little Linux netbook as the host - it doesn't need the whole life support system which a Pi does in order to run.

Last edited by SiriusHardware; 6th Oct 2020 at 6:19 pm.
SiriusHardware is offline   Reply With Quote
Old 6th Oct 2020, 7:08 pm   #15
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

There is another outstanding issue in the send14 script, not as serious as the one mentioned above, but it needs fixing.

If there is an execution address in the code at address FFFE-FFFF, the code is automatically run from the address found after it has been loaded.

Problem: The execution address is also, as a unwanted side effect of the use of this feature, typed into addresses 0FFE and 0FFF. The reason this could be a problem is that when you type something into address 0FFF using the monitor (which the uploader does) a copy of that data is placed in the status register, several bits of which control the state of Flag 0, 1 and 2.

If you have something being controlled by the Flag outputs, i.e. the VDU or that Death Ray project you've been secretly working on, then unintentional modification of their state is undesirable.

There's a bit in the code which is supposed to recognise when the address in the line is 'FFFE' and it turns off writes to the MK14 for the rest of the line. I believe that bit is actually working.

However, there is another separate part of the code which keeps a running record of the last address advanced to during data entry.

If the last address advanced to equals the start address of the current line, the script just stays in data entry mode and carries on entering the data from the current line.

If the last address advanced to does not equal the start address of the current line, the script switches to address entry mode, enters the start address of the current line, changes back to data entry mode and carries on entering the data from the current line, starting at the new address.

I think this last feature is finding the start address=FFFE and comparing it with the last address advanced to - finding it is not the same, changing to address FFFE and entering the two data bytes from the line into xFFE and xFFF.

However, I haven't yet decided on the most elegant way to fix this. Making substantial changes to Python code can be a nightmare because of the way code blocks are denoted by indentation rather than by something sensible, like curly brackets.
SiriusHardware is offline   Reply With Quote
Old 8th Oct 2020, 9:14 pm   #16
DeltaAlpha52
Triode
 
Join Date: Feb 2020
Location: Crawley, West Sussex, UK.
Posts: 29
Default Re: MK14 programming interface - Arduino version

Glad the arduino build is working for you. I have been working on getting my Nascom 2 working and producing a small PCB to hopefully handle a switch between Nassys3 and CPM. The PCB is still in the post at present.

I was thinking about including an SD card in the build to allow it to store a number of files ready to load, not sure what means to use to actually select the correct file. Then there is producing a PCB to attached the arduino to the MK14 now that I'm getting to grips with KiCad.

Take care
David
DeltaAlpha52 is offline   Reply With Quote
Old 8th Oct 2020, 9:42 pm   #17
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

I think there are SD card libraries out there for the Arduino but I have never tried to use them. Ideally they should be able to read a common PC filesystem like NTFS, and maybe they can?

I've just been looking at that other problem ref: the uploader accidentally messing up the hardware flags when the autorun feature is used. I think I may have it properly sorted, but the modifications involved a bit of (in)dental work and moving stuff around so it would be messy for anyone else to try to incorporate the changes by hand. I'll just post an edited V1.2 of the script when I'm sure it's working.

Usually when you get a PCB made in any of the usual places you have to order at least five, so let me know if you want to recoup some of the cost by selling one of the spare Arduino-version interface PCBs on. Others here might also take one off your hands.
SiriusHardware is offline   Reply With Quote
Old 8th Oct 2020, 9:58 pm   #18
Slothie
Heptode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 528
Default Re: MK14 programming interface - Arduino version

Quote:
Originally Posted by SiriusHardware View Post
I think there are SD card libraries out there for the Arduino but I have never tried to use them. Ideally they should be able to read a common PC filesystem like NTFS, and maybe they can?
I've used SD card libraries on an arduino, using the FAT32 file system. As I recall it didn't support long filenames but did support folders. Pretty easy to use I recall, but does use a huge chunk of both program memory and ram.
Slothie is offline   Reply With Quote
Old 8th Oct 2020, 10:04 pm   #19
SiriusHardware
Dekatron
 
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 4,808
Default Re: MK14 programming interface - Arduino version

I think what with that overhead, plus the additional hardware lines required for the SD card and those needed for a user interface - a display to see the files and some cursor buttons and a select button - you'd probably be looking at a Mega for such a project rather than an Uno.
SiriusHardware is offline   Reply With Quote
Old 8th Oct 2020, 10:16 pm   #20
Slothie
Heptode
 
Join Date: Apr 2018
Location: Newbury, Berkshire, UK.
Posts: 528
Default Re: MK14 programming interface - Arduino version

Yes, I had my Pi Zero W set up for "headless" operation (no keyboard, display) and just used SSH to connect via the WiFi from my laptop, so the only real advantage of using a SD card/menu type system is that it would not require you to have a laptop, handy for demos I guess. But a simple device like Delta suggests is a good tool since if your accessing with a laptop you can set up your dev environment on that, and the Pi can be a fiddle to set up if you're not a big Linux user.
Slothie is offline   Reply With Quote
Reply

Thread Tools



All times are GMT +1. The time now is 5:44 am.


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 - 2020, vBulletin Solutions, Inc.
Copyright ©2002 - 2020, Paul Stenning.