Author Topic: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)  (Read 152072 times)

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1200 on: August 29, 2021, 11:30:56 AM »
Another day going cross-eyed but quite a bit of progress  :thumbup:

I initially concentrated on the 'low battery alarm' circuitry which uses a dual precision comparator chip. Got it's wiring worked out but I couldn't for the life of me find where the output of the second part went. I couldn't trace ANY pcb tracks but it's not easy with SMDs ! Bright torches help shining from the other side, but not in this case. In the end I decided to butcher the original battery RAM card that was dissolved by the lithium juice prior to my ownership, and take the 8 pin SMD off the board. Hot air gun suitably applied only to reveal that despite the fact that it's inputs are connected, IT'S NOT USED  :clap:

OK go back to chasing real bits not virtual ones. Next on my list to nail was the three pin SMD labelled '45'. The look up list for SMD's said it could be a pair of diodes, a single diode, a transistor, or a voltage regulator so not much help. In the event looking at the original card (where this chip had completely disappeared!) in fact only two pins had tracks attached so it could really only be a diode (probably schottky from my meter readings)

Time to try and identify the SMD device labelled 'AJ' - again the list said that it could be almost anything, so I decided to pull one off the scrapped board and try and test it. Fiddly things these SMD chips - breath and they skid all over the place. In the end I super-glued it to a bit of wood, pressed pins in adjacent to the connections, and biased them together with a Hellerman rubber sleeve. Didn't do me any good - my component tester had no idea what it was. So I've drawn up just a block with three connections for the circuit drawing hoping that it's identity might be revealed by context.

I still have quite a few 10K resistors to positively tie to places in the diagram - several are definitely pull ups for gate inputs from the outside world, but I'll save to joy of finding them for tomorrow!
Andrew Mawson
East Sussex

Offline jiihoo

  • Jr. Member
  • **
  • Posts: 69
  • Country: fi
  • Finland - Northern Europe
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1201 on: August 29, 2021, 01:37:04 PM »
Watching with interest and learning from your reverse engineering techniques.

Tying all inputs of CMOS chips to a high or low level should be standard practice. Most CMOS chips (logic gates and comparators) will start oscillating if they have floating inputs, which can cause excessive current consumption and may interfere with adjacent circuitry. I assume Andrew knows this; this explanation is for others reading this thread :D

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1202 on: August 30, 2021, 06:28:10 AM »
So with a flurry of activity this morning I think I've got all the components accounted for and correctly interconnected on the circuit diagram - phew that was quite a bit of labour and eyestrain!

Of the 48 pins on the edge connector only two are not used (C15 & C16)

I still don't know what the SMD chips 'AJ' actually do, but from the circuit you can see that they are turning on the PNP transistor 'SMD-DB' when 5 volts is coming in from the edge connector, and turning it off when it's not present allowing power to pass to the RAM chips normally from the incoming supply, and be powered via the diode '45-SMD' from the lithium battery when system power of 5 volts goes away.

By my calculations the 'Low Battery Alarm'  (Pin A16) should be asserted when the volts of the 3.7 volt nominal battery fall to 2.8 volts.

Now I have the circuit I need to work out how to actually test it and hopefully fix what is wrong. The battery side should be pretty simple. Power up the card with 5 volts, replace the battery with a variable lab supply and see what happens when the voltage is lowered from 3.7.

However testing the rest isn't quite as simple. Simplistically all 16 address lines and 16 bi-directional data lines should be able to be toggled by applying a TTL signal so any 'stuck bits' could be found, but Id like to build a proper tester that writes to the ram and checks what is written. My first thought was something like an Arduino, counting up the address line in binary, and performing a write and a read but the number of input output pins gets large.
16 address, 16 data, plus Chip Select, Write Enable and Output Enable is 35 I/O lines - will an Arduino do this - I have no idea never having used one! I can cut the number down by 15 to 20 by building a 16 bit counter circuit for the address lines and just incrementing it but that limits me to only testing addresses sequentially which is not ideal.

. . .so comments please from all those Arduino experts out there !

Andrew Mawson
East Sussex

Offline Muzzerboy

  • Full Member
  • ***
  • Posts: 124
  • Country: gb
    • The Mighty Shiz
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1203 on: August 30, 2021, 07:29:54 AM »
That battery / psu circuit with the 2 "AJ" devices sort of makes sense to some degree. In the circuit, the LH one looks to be an NPN transistor and the RH one appears to be a zener - but the same device can't do both functions. Or can it?

The LH device looks like pin 1 - base, pin 2 - emitter, pin 3 collector, which is a fairly normal configuration for a bipolar transistor. You can use the base-emitter of a bipolar transistor in reverse as a zener (typ around 6.8V breakdown?) or emitter-collector for that matter. I've seen a few circuits over the years where that's been done.

Trouble is, the supply voltage is only 5V, so you'd never get the base junction to avalanche. It seems to almost make sense - but not quite!

Offline jiihoo

  • Jr. Member
  • **
  • Posts: 69
  • Country: fi
  • Finland - Northern Europe
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1204 on: August 30, 2021, 08:27:00 AM »
The Arduino Mega 2560 would fit the bill. It is the Arduino that has the most I/O directly on board: 54 digital I/O pins. It costs around €35.

https://www.arduino.cc/en/pmwiki.php?n=Main/arduinoBoardMega2560 has the specs.

I only dabble in Arduino, meaning I have a few of the boards and have compiled some simple sketches a few years ago. More knowledgeable members might be able to recommend a more optimal solution like a smaller Arduino with a suitable shield card. In my opinion the Mega ain't too badly priced and it would be a single board solution, so with my limited knowledge that's what I'd pick.

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1205 on: August 30, 2021, 09:13:57 AM »
Yes a bit of Googling brought me to the same conclusion  :thumbup:

Now the debate is on how much to do on board the Arduino and how much to bring back into the PC, but first I have a much simpler task - physically connecting to the 48 way edge connector in a way I can repeatably connect and disconnect things.

I rescued a 90 degree mounting PCB version of the correct socket, and I'd thought to just solder it into a bit of Veroboard for onward wiring, but it's three rows of 16 pins on a 0.1" matrix which rather scuppers that idea. I need a "DIN 41612 48 way breakout board" - I can't see that existing, or if it does King's Ransoms will be involved.

The pins are so flimsy that direct wiring even with sleeving, won't last ten minutes! Maybe the type of perforated board with separate pads might work, but I don't have any in stock ATM !
Andrew Mawson
East Sussex

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1206 on: August 30, 2021, 01:10:01 PM »
OK Arduino Mega 2560 V3 ordered and amazingly there ARE DIN41612 prototype boards available at a reasonable cost - RS do them but also on eBay . OK it's twice the width needed but that doesn't matter.

The three rows of pins are accommodated but only the outer (A&C) rows are extended, the remaining B row just having isolated pads but it should work OK I think.

Another bonus - I've found some Arduino 2560 Mega code on Github that has been written to test 62256 ram chips which should prove a time saver - OK I need to tweak it as it is only doing 25% in terms of data width and address length, but the donkey work has been done  :thumbup:

Andrew Mawson
East Sussex

Offline mc

  • Full Member
  • ***
  • Posts: 108
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1207 on: August 30, 2021, 01:56:10 PM »
I would have probably went for an Arduino Due to give some extra processing power, but a Mega will do the job.

I was going to suggest a Raspberry Pi, depending on what programming language you prefer, but having just checked, they only have a maximum of 17 GPIO pins.

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1208 on: August 30, 2021, 02:09:56 PM »
But the Due is a 3.3 volt system that adds a further layer of complexity as the Ram card is all 5 volt TTL signal levels.

Speed isn't really an issue, it can just churn away counting through all 64K addresses with 64 data variants, though probably I won't, I'll do all ones, all zeros and the old U*U* sequence which gives alternate ones and zeros.

In practice I'm not looking for marginal issues with this RAM, it'll either work or not, but the tester will let me exercise the address lines and data lines which I can then check with a 'scope while it's running  !

I suspect that the EPROM cards in this controller use exactly the same interface (except for writing)  so hopefully I'll be able to peek inside them as well.

Andrew Mawson
East Sussex

Offline jiihoo

  • Jr. Member
  • **
  • Posts: 69
  • Country: fi
  • Finland - Northern Europe
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1209 on: August 31, 2021, 05:15:54 AM »
I've done embedded software at work. And still do. I've seen a memory test - provided in source code format by a chip vendor - that failed to identify broken or incorrectly soldered memory chips.

Two different kinds of memory tests are needed: Ones that exercise the memory byte-by-byte or word-by-word and ones that exercise the address lines.

1) All ones, all zeros and 0x01010101 written one memory address at a time are of the first category (exercise each memory location). So is the classic "walking bit" where you walk first a 1-bit through a memory location (with all other bits being zero) and then continue this from the next memory location until end of memory. Once the whole memory is tested this way you'd follow this up with a walking 0-bit test.

This category of tests proves that each of the data lines works and that each memory location works assuming the address lines worked correctly. And that is an assumption that needs to be verified next.

2) This category of tests verifies that all address lines work correctly and that each memory location really is a separate memory location. Here you need to first fill the whole memory with some non-repeating pattern (or a pattern that does not have a cycle length divisible by 8) and then read it back verifying that each memory address returns what was written there. You could use the fibonacci sequence (1, 1, 2, 3, 5, 8, ...) for this (use unsigned integers for the math; yes it will overflow but that does not matter as there should always be enough variance in the least significant bits that are left after an overflow...) Or you could just write "memory address + 11" to each memory location (the +11 is arbitrary but important as you don't want to use the same data as the memory address...). Anyway, write all memory addresses with your chosen sequence first and then read back all memory addresses and verify that the expected data is there.

Why is the category 2 test needed? Well, assume you have a 16-bit system (64k addresses) that has a solder bridge between the two most significant address line bits. Or a broken memory chip that internally shadows the upper half of its memory on top of the lower half. The first category of tests is not going to catch that. What will be seen is that the lower 32k of memory works correctly and the upper 32k of memory works correctly when tested byte-by-byte or in blocks less than 32k, but once the whole memory is tested at once it will be noticed that the upper 32k is the same as the lower 32k...

Actually if testing byte-by-byte even totally unconnected data lines might pass the test if there was a sufficient amount of stray capacitance on the data lines...

My real-world experience with the memory test that didn't find problems was only doing the category 1 test, I think it was doing the walking bit test. This kind of test is ok if you are looking for random errors in memory that is otherwise working ok, but not ok for finding soldering mistakes in production or badly misbehaving memory chips.


Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1210 on: August 31, 2021, 05:57:10 AM »
The classic 'first test' for a memory test program is to write 'own address' into each location, then read them back in reverse order.

(This is often followed by 'inverse own address')

As you say overlapping addressing will never show up on a 'write a byte, test a byte' test as you don't really know where it is putting the data.
Andrew Mawson
East Sussex

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1211 on: August 31, 2021, 09:59:26 AM »
I realised that I'd made a wrong assumption regarding the Data and Address bus terminations - the Data bus wasn't terminated at all ! So for the sake of completion here is the amended circuit:
Andrew Mawson
East Sussex

Offline Muzzerboy

  • Full Member
  • ***
  • Posts: 124
  • Country: gb
    • The Mighty Shiz
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1212 on: August 31, 2021, 01:14:27 PM »
Getting there! FWIW, A12 has two 10k pullups. Is that because one is redundant or should one of them be pulling up another line?

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1213 on: August 31, 2021, 02:04:00 PM »
I'm struggling to find two pull ups for A12, give me a clue !

The intended one is on resistor pack G pin 2.

Are you maybe confusing edge connector pin A12 with Signal A12 - I know it's a nightmare of alphanumerics !


Later Edit:

Ah found what you mean
Andrew Mawson
East Sussex

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1214 on: August 31, 2021, 02:22:28 PM »
The logic driving the four chip select pins on the Ram chips is a bit odd - I can't quite work out what they are trying to achieve  :scratch:
Andrew Mawson
East Sussex

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1215 on: September 03, 2021, 06:03:03 AM »
Well well, a little progress  :thumbup:

Arduino Mega 2560 R3 has arrived - it did a few days ago but farming things took priority. I did just plug it in and download the IDE (Integrate Development Environment) and write a little diddy LED flasher but it failed to upload and no time to sort it out.

But today I had time to have a 'look see' : Simple really, tell the compiler that you have a Arduino 2560 R3 and not the Uno that it was set up for and it WILL upload  :ddb:

So a bit of playing about changing flash rates etc - nothing at all complicated, then I went off to GitHub and cloned the already written code for the 62256 SRAM chip to see how the author has approached the problem. The code compiles and runs but of course isn't connected to anything yet, but at least it's basically working, and will give me good ideas to structure my own version.

Still awaiting the breadboard and anyway being a Friday another two cottage change overs to perform and tomorrow a field to flail so hopefully Sunday or Monday I'll have a crack at it.

PDF version of the cloned .ino file attached - now I need to discover how to open .md read me files and I'll be well away  :thumbup:

Andrew Mawson
East Sussex

Offline russ57

  • Sr. Member
  • ****
  • Posts: 278
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1216 on: September 03, 2021, 07:31:18 AM »
Pretty sure..md is just text.
Probably rename would be easiest..
-update = md is markdown so it could have formatting tags
-russ

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1217 on: September 03, 2021, 08:36:53 AM »
Yes I whipped the .md off the file name and opened it with Notepad. As you say it's just text but un-formatted so I saved it with word wrap on to make it marginally more readable.

I presume that there's a way of opening .md files within the IDE but I've not found it yet.

As he doesn't vary his data it's amusing to watch it  'pass' my open wires as good, but never the less it's a very useful introduction for me.

I'm quite looking forward to get it driving the RAM card - a load of jumper leads arrived this morning, and supposedly the break out bread board is 'out for delivery' but no sign yet !

 
Andrew Mawson
East Sussex

Offline AdeV

  • Madmodder Committee
  • Hero Member
  • *****
  • Posts: 2434
  • Country: gb
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1218 on: September 03, 2021, 06:10:27 PM »
Yes I whipped the .md off the file name and opened it with Notepad. As you say it's just text but un-formatted so I saved it with word wrap on to make it marginally more readable.

I presume that there's a way of opening .md files within the IDE but I've not found it yet.

The Arduino IDE is pretty rubbish by modern standards, although having all the tools to make it talk to the Arduino makes it handy. Your best bet for reading .md files is actually to read them on-line (the default README.md is shown automatically by github, underneath the list of files. Any .md file you click on in the github list will also render nicely on the browser.

Failing that, download & install Visual Studio Code (free from MS). It will run on anything (Windows/Linux PC or Mac), and will also render .md file (right-click the file, open preview).

As he doesn't vary his data it's amusing to watch it  'pass' my open wires as good, but never the less it's a very useful introduction for me.

I'm quite looking forward to get it driving the RAM card - a load of jumper leads arrived this morning, and supposedly the break out bread board is 'out for delivery' but no sign yet !

Welcome to the wonderful world of Arduino!  :borg: The "usual" way of increasing the number of useful data pins is to use one (or more) 74595 chips (serial-to-parallel) or 74165 (parallel-to-serial) shift registers, which at the expense of a bit of speed, gives you a effectively as many digital I/Os as you could ever need.  :headbang:
Cheers!
Ade.
--
Location: Wallasey, Merseyside. A long way from anywhere.
Occasionally: Zhengzhou, China. An even longer way from anywhere...

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1219 on: September 04, 2021, 02:46:48 AM »
Ade, amusingly the serial to parallel approach was what I used to make a 48 bit wide (iirc) pneumatic interface to drive what had been a paper tape input to my Moog Hydropoint 1000 which was my first NC machine back in the 1980’s.

All driven off a single bit on a PC parallel printer port. (A second bit acted as clock) Amazingly it actually worked quite well.

(The Hydropoint blew air though several stripes of holes at once in the paper tape and the air drove tiny actuators moving parallel plates with holes in that the hydraulics servo system used as it’s set point. That was quite a learning exercise!)
Andrew Mawson
East Sussex

Offline mc

  • Full Member
  • ***
  • Posts: 108
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1220 on: September 04, 2021, 03:42:34 AM »
As Ade says, the Arduino IDE is pretty dated, but it's functional.

An alternative for reading .md files, is Notepad++
It's quite a handy text editor, and I have it installed on most of my computers.

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1221 on: September 04, 2021, 05:58:29 AM »
Well never mind, I'm pretty dated myself (72 on Monday)  :clap:
Andrew Mawson
East Sussex

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1222 on: September 04, 2021, 10:59:06 AM »
A bit more progress. I have rigged up +5 volt power to both faulty RAM cards, proved that they are not drawing excess current, and rigged a second supply up to emulate the back up battery (set at 3.7 volts)

This has allowed me to prove that the low battery alarm circuit on both cards is working correctly (+5 volt for Battery OK, close to zero for low battery).

Card #1 has a 'transition voltage' for the battery alarm exactly at the calculated 2.8 volts, but card #2 has a trigger point of 3 volts. I don't think that this has any significance but we may see later that that's a false assumption!

The bread board having arrived has let me think a bit more about the physical side of further testing, or rather  oscilloscope probing of the board under test. As most components are SMD's, unlike through hole devices you need to be able to probe both sides of the PCB. This dictates that either I stand the board vertically (which makes getting at it a pain) or have the board connector hanging off one end of the breadboard.

I've chosen the later method but this has persuaded me to incorporate header pins to connect to the Arduino rather than as I had previously intended - using directly soldered flying leads. My drawer of rows of header pins is a bit on the low side so an order has been placed with RS.

« Last Edit: September 04, 2021, 11:45:26 AM by awemawson »
Andrew Mawson
East Sussex

Offline Muzzerboy

  • Full Member
  • ***
  • Posts: 124
  • Country: gb
    • The Mighty Shiz
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1223 on: September 05, 2021, 08:07:17 AM »
Wow I just spotted the Weir Minireg there and I must have missed the post you did about it last year. https://www.madmodder.net/index.php?topic=12909.0. Stud diodes, germanium transistors, hand wired chassis.....

I started out at Farnell Instruments (SMPS group) latterly Farnell Advance Power back in the early 80s, when Weir (and Coutant) were competitors. All gone now apart from Coutant who are owned by TDK (but still apparently living in the 60s).

Offline awemawson

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8966
  • Country: gb
  • East Sussex, UK
Re: The Sequel - Oh Blimey I bought a CNC Lathe (Beaver TC 20)
« Reply #1224 on: September 05, 2021, 10:44:48 AM »
A bit more progress today. I've mapped out the logic that drives the four CS lines - one for each RAM chip.  It looks as though the board has been designed to be able to be read both in 'Byte Mode' and 'Word Mode' ie 8 bits or 16 bits of data.

In proving the working of the circuit using dead board #1 I was going round in circles as it turns out that the line on edge connector pin A12 wasn't being pulled 'high' by it's 10K resistor. Now that particular lines goes to several pins on both 74HC00D chips , and one of them is driving to 0v when powered up. Impossible to tell which without removing a chip. To this end I've ordered some (minimum order 50 off as they are SOIC-14 smds !)

Board #2 has a faulty "SMD DB" transistor which I believe translates to be a BCW67C - again in an SMD package - so I've ordered some of those (100 off for £1.94 !!)

So this is going to be a learning exercise in SMD reworking for which I've bought a hot air rework station etc - about time I got equipped !
Andrew Mawson
East Sussex