Tag: 8032

Repairing a Digital Clock – or how to erase EPROMs

On my workshop wall I have a digital clock. Now digital clocks are not normally something of any interest but my clock had 2 ½ inch (6.5cm) high red LED characters which meant that it could be read from any location in the shop and it has been running 24 hours a day for almost 20 years.

Recently it stopped – no display, dead. Looks like I needed to see if I could restore it to life.

On removing the PCB assembly from the case I found that it comprised 2 stacked PCBs – a control board and a display board. The control board had an 8052 family microcontroller and a DP8572 RTC chip. The display board had 2 x MM5450 LED driver chips to light the series LED strings that made up each of the 7 segments of the 4 digits of the display.

The 2 PCBs

The 8052 was an extremely popular microcontroller from the 80s. It was first developed by Intel and second sourced by a myriad of other semiconductor manufacturers. Even today its instruction set is the basis of many devices but of course with much faster clock rates and additional peripheral functions.

The actual chip used by the clock was an 8032 which is the ROM less version of the 8052. An external ROM is needed to provide its program memory.

Control PCB in detail

ROM less 8052s were often used in products as the 8052 only had an inbuilt program memory of 8K and this was masked ROM which meant that the code had to be programed in by the semiconductor manufacturer and they would have a minimum purchase quantity requirement. If program changeability was required then a new micro chip had to be manufactured to replace the old chip on the PCB or the much more expensive UV erasable 8752 used. Using external EPROMs gave both flexibility and cost benefits.

With the introduction of Flash memory UV erasable memory has been consigned to the history books but what I had was a faulty clock with a micro that used an EPROM for program memory.

Fault Finding

First I checking the power supply. It was a basic transformer and rectifier which delivered 8-9VDC un-regulated for the displays and fed a 3 terminal linear regulator to provide 5V to the micro and its companion circuitry. After checks, everything there looked OK.

The microcontroller circuitry was looked at next. All chips except for the EPROM and RTC were soldered to the PCB so powered fault-finding would have to be used rather than chip substitution.

Powering the control PCB and probing around the various signals with a logic probe the micro appeared to be totally inactive. Using an oscilloscope there appeared some activity on the XTAL1 and XTAL2 pins but that was it.

Of specific concern was that there appeared no ALE (Address Latch Enable) activity. To allow the 8052 family micros to address external program memory they multiplex their memory data and address lines. A latch de-multiplexes the 8 LSB address lines from the 8 data lines using the micro’s ALE signal to enable the latch.

A mimimal 8052 schematic

Without ALE activity the micro would not fetch program instructions to execute. Was there something wrong with the EPROM, the latch, or the micro? As the EPROM was socketed it could be checked first. It was time to dig out my micro development tools from the good bad old days.

Back when I used to work with 8052s one trick for checking out a system I was bringing up was to create test ROMs. These allowed memory to be stepped through regularly so that that address or data signals could be synced to and displayed on an oscilloscope. Logic analysers were expensive devices so a normal oscilloscope could be pressed into service this way.

I would need a PROM programmer plus an EPROM eraser and some spare EPROMs to create a test ROM. A trip to the storage shelves in the garage found the programmer and some pulled PROMs but where was the eraser? An eraser is a unit containing a UV lamp, a timer, and a drawer into which you place the EPROMs to be erased. When the drawer is closed the UV lamp starts and given sufficient exposure time erases the EPROMs, generally around 30-40 minutes as I remember. The timer also prevents over exposure which may degrade the EPROM internally. After further fruitless hunting for the eraser, I gave up.

At least I had the programmer so I inserting the EPROM from the clock into the programmer and attempted to read it. Various hex characters with the odd readable ASCII string were displayed on the companion PC application, so it looked like the EPROM was readable.

A ROM filled with NOPs (No Operations) is the most basic test code for any micro. The NOP instruction for the 8052 is 0x00 so I need to write an EPROM containing all zeros. An EPROM needs to be erased before it can be re-programmed. Erased EPROMs reads as all 0xFF. How could I erase one of my spare EPROMs so it could be re-programmed? Supposedly an EPROM with its window exposed will be erased by strong sunlight in a few weeks but I was not planning on waiting weeks.

A Substitute EPROM Eraser

That weekend I made a trip to the local charity store. You never know what you may find there, and this time I spied a used UV nail lamp for $5. After a bit of banter from the ladies in the shop about why I would need a nail gel drying lamp, I took my lamp home (who says only middle-aged men are sexist).

I popped some EPROMs into its hand aperture, turned on the unit and 3 of the 4 lamps lit. I then waited for 40 minutes. I removed the EPROMs and checking them in the programmer but none were erased. I tried a second time and still they did not erase. A bit of online research refreshed my memory on the type of UV lamp that is needed to erase EPROMs. The light wavelength must be around 253 nm and nail gel drying lamps have a UV wavelength in the range of 340-380nm. So these could never work as an eraser.

With nothing to lose, I decided to open up the nail lamp and see whether I could fit different lamps. The enclosure was usable and the unit had an electronic timer which perhaps I could modify to suit EPROM erasure times.

The nail lamp’s internals

Looking at the lamp in the unit they reminded me of the germicidal lamps used in aquarium water sterilizes. A bit more internet research indicated that both gel drying and sterilizing lamps are available with a G23 base, have power ratings of 9-11 watts, and potentially used similar ballasts to operate them at 110-220VAC. Therefore I visited my local pet store and purchased 2 sterilizing lamps and being the weekend I began some experiments.

UV lamps. Germicidal on right

Internally the nail lamps circuit appeared to simply rectify the mains then drive a self-oscillating high-frequency converter. All the lamps were driven by the output from this converter through individual ballast inductor. The timer function was NE555 based. In timer mode, it turned on a power MOSFET to enable the converter for 2 minutes. The converter output was measured and found to be around150VAC at a frequency of 20KHz. Output at the lamp fell to 50VAC once the lamp struck.

As lighting would not be needed from the sides for EPROM erasing I only planned to install the germicidal UV lamps at the topmost 2 positions in the hand chamber. After a few checks of whether they would fit, I installing the germicidal lamps and turned on the unit. For tests while the case was open I left the lamps covered with their boxes because their light is dangerous and could cause skin or eye damage.

Unfortunately at power on I noted that the heater elements of the lamps only glowed very dully and then when the starter in the lamp’s base operated the lamp did not strike until at least 30 seconds of failed attempts to light. Obviously, I needed to run the heaters at higher temperatures to increase ionization so that the lamp would strike more quickly. With the lamps lit the voltage across them measured 40VAC and the frequency of the converter had risen to around 24KHz. I concluded that the germicidal lamps were drawing somewhat different power to the original gel drying lamps although all were nominally rated at 9W. As a gas discharge lamp’s voltage drop when in glow discharge depends on its internal gas composition and remains relatively constant with varying lamp current, power cannot be inferred from a voltage measurement. As I was only going to use 2 lamps, not 4 I felt that the converter would not be overloaded even if the new lamps were drawing more power.

As I often do when fault finding items without circuit information I decided to trace out the circuitry around the areas of interest. As the circuit was relatively simple I ended up tracing the complete schematic.

Lamp schematic (as traced)

After reviewing the converter arrangement there appeared no way to increase the heater current except by reducing the ballast impedance. The only practical way of doing this using the existing components was to parallel 2 ballast inductors to one lamp. This I did and the lamps were found to strike within 1-2 seconds of power-on. I now had the lamps lighting but what was the lamp power? With the reduced ballast impedance was I overloading the lamps hence shortening their life?

Modified wiring for germicidal lamps

Gas discharge lamps have negative resistance characteristics while the converter’s self-oscillating frequency is dependent on its load. This would be quite a complex interaction and too much analysis to do in PSPICE for a Saturday afternoon. In the end, I decided to be pragmatic. My lamps were of an unknown brand but according to online data published by Osram germicidal lamps of their manufacture have an operating life of 8000 hours. As I only wanted to run my lamps a few times for less than 1 hour at a time to erase EPROMs the lamp life was not an issue of concern.

The nail lamp has a timer that gives an operating time cycle of 2 minutes. I wanted to erase my EPROMs for 30-40 minutes. Although a NE555 is capable of providing time delays of hours it not normally used for such long periods due to practical considerations of the timing components. The circuit had a timing resistance of 1M ohm and a timing capacitance of 100uF which gave an operating time of 2 minutes. I needed to increase this time 15-20 times. Practically the resistance should be kept under 2M ohms due to trigger pin current requirements so I decided to leave the timing resistance as it was and increase the capacitance. For capacitances of 10-15 times 100uF only electrolytic capacitors are available. Electrolytic capacitors have large capacitance tolerances and leakage current which are temperature dependant so are not ideal for precision timing but again being pragmatic I just need a rough time delay to shut the UV lamps off after a suitable erasure time had elapsed.

Following through the NE555 circuit arrangement I found that it was being operated at a Zener regulated 10VDC supply. As the timer’s internal trigger voltage is 2/3 of supply voltage the capacitor would need a working voltage of at least 6.7V. This meant that the common 6.3V working voltage of many high value electrolytes would not be suitable. In my parts drawer I did have some 1000-2200uF 10V working capacitors so I selected the capacitor from those. What I wanted was a capacitator with low leakage current so as to not drastically affect timing. I found that various brand capacitors, especially if low EST types, had appreciable and different leakage current (uA). In the end I settled on a Teapo 1500uF 10VW part.

Testing this capacitor in the circuit over a couple of trial runs the operation time was found to be 40 minutes maximum, which was in the range I required so I installed that capacitor permanently.

On reassembling the modified nail lamp and after conducting a few more operational tests I placed all my pulled EPROMs onto a piece of antistatic foam and inserted them into the hand opening of the lamp. I faced this opening to the wall so no one could accidentally look directly at the lamps, then ran an erasure cycle. There was enough glow through the plastic of the case to see that the lamps were on. After the cycle completed I checked each EPROM with the programmer and found all were blank. Next, I wrote one EPROM to all 0x00 to use as the test ROM I required.

Modified lamp in operation

Clock Repair

I installed the newly created test ROM into the control PCB’s memory socket, powered up, then monitored the ALE signal.

Unfortunately still no activity!

Re-grouping my thought I consider what I had discovered so far and realized that I had never actually seen clock activity with the logic probe, only some signal with the scope. The clock oscillator should have had a recognizable clock waveform at its XTAL2 pin – the output of the oscillator, but the probe did not detect any logical level activity. Was the crystal the problem? Digging through some junk circuit boards I eventually came across an 11.05MHz crystal, the frequency of the crystal on the PCB. I installed this crystal and tested the PCB again. Regular activity was observed at the ALE pin. So the crystal was a problem.

Next, I-installed the original EPROM into the clock board and re-attached the display board. On power-up I was greeted with a functional clock. again.

Clock working again
Note: graduated display brightness is due to camera being close to display
Also the contrast is much higher when the display is behind the case’s red filter

Before putting everything back in the case I checked out the display in detail. I noted that an LED on one of the display segments was less bright than the rest. As all the LEDS had probably be brightness matched I removed a status LED from an unused function – date mode, and swapped it with the dull LED. The time display now looks 100%.

Although I had spent a day faultfinding a basic digital clock most of that time was trying to obtain the appropriate tool set. Also I had revisited memory lane.

Finally, during my internet browsing I had read that EPROMs have a theoretical data retention life of 25 years so I cloned the original clock EPROM to have a spare if it ever failed. Let’s hope I can find it in another 20 years’ time and perhaps I will also find my original EPROM eraser then.