Replacing Obsolete micro? - Page 1
Forum section: electronics / general

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 19, 2020, 04:51:17 pm
content: I have an interesting project.I have a PCB that uses an old MCHC705B16NCFNE micro, which is obsolete.Data link here:https://www.nxp.com/docs/en/data-sheet/MC68HC05B6.pdfI have access to the PCB build files, but not the original files for compiling the micro's program, so all I could do is copy the program directly. I was able to find a small supply of "NOS" from an Asian source, but so far only about 25% of the micro's I've ordered actually function. The customer would like between 100 and 200 finished PCBs if this is possible, and neither he nor I are happy about using likely counterfeit/faulty micros, and would like something new from a reputable parts house.I've never attempted such a thing before, but is anybody aware of a micro that is still in active status that could accept the copied program? Package difference is no problem, as I can re-configure the PCB to accept whatever.Thoughts?

author: greenpossum
author_rank: Frequent Contributor
timestamp: July 19, 2020, 05:11:48 pm
content: Just out of curiosity I looked up this micro, which I have seen but never used. The wiki page claims that the HC08 is code compatible with the HC05 but I have no idea if that means assembly code compatible or binary code compatible. Maybe this can be a starting point for further searching?https://en.wikipedia.org/wiki/Motorola_68HC08

author: Andreas
author_rank: Super Contributor
timestamp: July 19, 2020, 07:51:59 pm
content: Usually Rochester is a serious source:https://www.rocelec.com/search?q=705B16Sometimes they also re-built devices with the orignal masks from the previous supplier.with best regardsAndreas

author: Kjelt
author_rank: Super Contributor
timestamp: July 19, 2020, 08:19:19 pm
content: How large is the source code?If <4kB you could Reverse engineer the disassembly code or reverse engineer the functionality with logic probes.You have to do that anyway unless you find a 1:1 mapped compatible cpu.I did this in the late 80s with a 8048 eprom of 2kB.Within two weeks you can get this done and you can write new code in C on any uC you like.Even if you find a code compatible cpu you still have to retest each and every functionality.Without the code, how do you know you tested everything ?

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 19, 2020, 09:33:00 pm
content: Quote from: Kjelt on July 19, 2020, 08:19:19 pmThe idea (hopefully) was find a compatable micro, clone the code over, make an adapter PCB (for testing purposes), solder it on and see if it functionsReverse engineering the functionality is more likely, TBH. I may have to get with someone who far more software savvy than me and see if we can do something. It would be less than ideal, but maybe the last resort?

author: up8051
author_rank: Frequent Contributor
timestamp: July 19, 2020, 09:45:15 pm
content: First check how many pins are used and what functions they have.

author: andersm
author_rank: Super Contributor
timestamp: July 19, 2020, 09:53:00 pm
content: A more extreme approach would be to emulate the original microcontroller on a more capable device.

author: brucehoult
author_rank: Super Contributor
timestamp: July 19, 2020, 10:48:19 pm
content: Quote from: andersm on July 19, 2020, 09:53:00 pmThat's probably the smallest amount of work, to be honest.I haven't checked how close it is to vanilla 6800, but I can write a cycle-accurate purely interpretive emulator for that class of CPU core in a couple of days if I have a significantly faster CPU to run it on. If it's running at 1-2 MHz with multiple clock cycles per instruction you might just about be able to emulate it with a 16 or 20 MHz AVR (it might be a challenge). With a 48 MHz or something ARM it would be cake.Mapping the timers and I/O would be more work. You'd have to figure that out if you went the hand-disassembly-to-C route anyway.I'm free at the moment and enjoy doing this kind of perverse thing so HMU if you're interested (on a commercial basis).

author: brucehoult
author_rank: Super Contributor
timestamp: July 19, 2020, 11:00:31 pm
content: There's a 6805 emulator herehttps://github.com/forthnutter/6805Written in some kind of wacky FORTH that runs on the Java VM, so probably not useful except maybe as a reference. Seems to be BSD license.

author: JXL
author_rank: Regular Contributor
timestamp: July 19, 2020, 11:12:18 pm
content: These guys may be able to supply your needs:https://www.tekmos.com/products/microprocessors/68hc705-microcontrollers

author: brucehoult
author_rank: Super Contributor
timestamp: July 19, 2020, 11:12:58 pm
content: The MAME project has a 6805 emulator athttps://github.com/mamedev/mame/tree/master/src/devices/cpu/m6805That might be more useful. GPL license.

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 19, 2020, 11:26:16 pm
content: Quote from: JXL on July 19, 2020, 11:12:18 pmOOOOOOOOHHHHHHHHHI will call on Monday!

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 20, 2020, 05:14:43 pm
content: Got a reply back from Tekmos.They have a MOQ of 100 units $30/unit. Just an FYI for anybody else interested in this particular micro.Since I no longer have access to the source code, and can only read the micro with a programmer, that limits programming.Tekmos specified they need the program in HEX of S19 format.Usually, I'm just straight cloning memory ICs and run PCB layout and population, programming is out of my area of expertise. Any idea if from just reading the OEM micro I can get the program to Tekmos in the format they require?

author: Jay1011
author_rank: Contributor
timestamp: July 20, 2020, 06:48:19 pm
content: Perhaps try also:https://octopart.com/search?q=mc68hc705b16&currency=USD&specs=0&in_stock_only=1The results show several distributors with stock, including "GreenTree Electronics" with >22K in stock. I have no idea if that's true or if GreeTree is a reputable company, but might be worth a check.

author: Kjelt
author_rank: Super Contributor
timestamp: July 20, 2020, 08:27:07 pm
content: Quote from: Rat_Patrol on July 20, 2020, 05:14:43 pmWhat is the definition of unit ? Not 1 piece I hope ?

author: brucehoult
author_rank: Super Contributor
timestamp: July 20, 2020, 10:44:35 pm
content: Quote from: Rat_Patrol on July 20, 2020, 05:14:43 pmInteresting. What's the lead time?For a small and simple chip like a 6805, that price would give a very healthy margin over the cost of making a batch (usually 100) on a shuttle run aka MPW (Multi Project Wafer).

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 20, 2020, 11:10:01 pm
content: Quote from: Kjelt on July 20, 2020, 08:27:07 pmYes, $30 per piece.

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 20, 2020, 11:10:41 pm
content: Quote from: brucehoult on July 20, 2020, 10:44:35 pmI did not get a lead time, but their website mentioned the 100 MOQ for in-stock items, 3k for new runs.

author: srb1954
author_rank: Super Contributor
timestamp: July 20, 2020, 11:33:50 pm
content: If you can read from the micro as a binary file it should be pretty straight-forward to convert to an S19 file. Any decent EPROM programmer should be able to save the binary file to an S19 format. Failing that you could write a program on your PC to convert a binary file to S19 format - it is a very simple format to convert.You might to consider converting to a more recent Freescale processor like the RS08 family. This will be largely compatible at an assembly language level but probably not at a binary level. To get the assembly language source code from your existing program you will need to disassemble the binary but this shouldn't be too hard - the 6805 series has a very simple processor architecture.If you are changing processors one of the most important factors will be to get a processor that has a similar peripheral set to the original. You are more likely to get this match if you stick with something from the Freescale repertoire as most of their 8-bit processors share a similar peripheral set.As a lot of the code in a typical low-end embedded application is I/O intensive so changing to another processor family could involve considerable rewriting of code to drive the new peripherals to obtain the necessary I/O functions.

author: brucehoult
author_rank: Super Contributor
timestamp: July 20, 2020, 11:44:10 pm
content: Quote from: Rat_Patrol on July 20, 2020, 11:10:41 pmThat's pretty exorbitant, but if you only want 200 boards then you're probably best off to just suck up that $6k, especially given you don't have to redesign the board.I hope they charge a lot less for the 3000 chip runs. For $90k you could get someone to emulate it in a $10 FPGA or a $1 or $2 ARM. I don't know if you could get the same package -- it looks like it's also obsolete.

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 21, 2020, 10:51:23 pm
content: Quote from: brucehoult on July 20, 2020, 11:44:10 pmYup, spendy, but we we are still discussing options. These are control boards for some old industrial equipment that is still popular/in use, so it is may be better money (and a biz opportunity) to make some PCB re-designs and updates, and run on an emulator and make a couple thousand boards.The emulating one micro on another micro is something new for me, that will take some investigation, but we would likely job that out. Any idea what we may expect to pay for someone to make that work?

author: andersm
author_rank: Super Contributor
timestamp: July 22, 2020, 06:24:05 am
content: If you haven't already, also try to estimate the cost of reimplementing the software from scratch.

author: Wiljan
author_rank: Regular Contributor
timestamp: July 22, 2020, 11:08:32 am
content: Maybe you could use a MC68HC05 clone for a FPGA with the bin dump filehttps://opencores.org/projects/68hc05

author: up8051
author_rank: Frequent Contributor
timestamp: July 22, 2020, 11:22:55 am
content: Do you have access to the code binary/hex file?Microcontroller can be protected to readout.

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 22, 2020, 02:38:35 pm
content: Quote from: up8051 on July 22, 2020, 11:22:55 amYes, we can pull the the program from the micro.

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 22, 2020, 06:07:35 pm
content: Quote from: Wiljan on July 22, 2020, 11:08:32 am@WiljanI'm not a software guy, so could you (or anybody) elaborate on this? Is it the same as an emulator?

author: brucehoult
author_rank: Super Contributor
timestamp: July 22, 2020, 09:11:48 pm
content: Quote from: Rat_Patrol on July 22, 2020, 06:07:35 pmAn FPGA is hardware. You design a hardware logic circuit that does what the original microcontroller does. It's I suppose more of a clone than an emulator. The circuit won't be exactly the same as the original, but maybe somewhere close. You could implement your circuit in 7400 MSI, you could put it in a custom chip. Or you can put it in an FPGA. FPGAs have large numbers of logic gates, flip-flops, SRAM, ALUs. You wire them up according to your design. It's fairly easy to get a modern FPGA to run a CPU at around 50 MHz to 100 MHz, which is a lot faster than ancient micros.

author: Wiljan
author_rank: Regular Contributor
timestamp: July 22, 2020, 09:57:12 pm
content: Running a soft core CPU in a FPGA means you program the FPGA to have the same logic chip as a CPU does have internally and also the ROM so it can run the program.Then you have to route the intentional connection to physical pins on the FPGA and have the right voltage levels / clk etc and then the FPGA will do the same as the CPU . It's typical what some people do when the run like "Pacman"from a Z80 CPU but now in a FPGAhttps://www.fpgaarcade.com/kb/pacman/Softcores form many different CPU's are availablehttps://en.wikipedia.org/wiki/Soft_microprocessorhttps://opencores.org/projects?expanded=ProcessorIt might be a solution for you but sure the PFGA will need quite some learning for you if you never used it beforeI see the link I gave you for the 68H05 have only VHDL code and have as good as no docIf you look on the T48 there are much more documentation sure for a total different processor but the idea is exactly the samehttps://opencores.org/projects/t48https://opencores.org/websvn/filedetails?repname=t48&path=%2Ft48%2Ftrunk%2Fdoc%2FT48+Integration+Manual.pdfHope it makes a little sense

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 22, 2020, 10:15:35 pm
content: Let me see if I understand this properly:I could take a shelf FPGA, "program" it for the pinout of the obsolete 68 (I understand different footprint, no big deal as I can re-design the PCB to accomodate), and then I can upload the binary/hex to the FPGA and it would act as the obsolete 68?Surely it is more difficult than it sounds?

author: up8051
author_rank: Frequent Contributor
timestamp: July 22, 2020, 10:33:24 pm
content: It's more difficult because of peripherals (timers, serial interfaces, PWM) and special ADC.

author: Kjelt
author_rank: Super Contributor
timestamp: July 23, 2020, 08:11:34 am
content: If you are really talking about thousand(s) of boards and product continuation for coming ten years this would IMO be the right time to invest in a new uC and re-design.What the company did wrong and should now improve on is not using a third party or make good agreements with the 3rd party company such that:1 there is good documentation , architecture, UML diagrams flowcharts and source code2 that they own the source code and the software is written in a universal language preferably C or C++3 aftercare, bugfixes, new features etc.Do not use a single individual or 1-2 man startup or small company unless you know they have an excellent trackrecord and are well known.Hire a larger company that has multiple embedded software and hardware people in their services. Here in the vicinity of Eindhoven there are at least 5 of those companies I would entrust it to, so this is not difficult. Make it a fixed price inhouse (their house not your company) project and they have experienced engineers helping new hires and existing people that have no current work on it and thecequipment.This might be more expensive at first but essential to guarantee point 3 and have a better guarantee that the project will be completed (had my share of experiences with 1 man companies that went belly up or could not deliver in the end what was promised, quality of the software can also be terrible).

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 23, 2020, 08:21:08 am
content: Quote from: Rat_Patrol on July 19, 2020, 04:51:17 pmWhy do you not have access to the originals? Is this a RE exercise?It's difficult to suggest an approach without knowing the scale of your problem and the margins? If it is large then it's a redesign, if it is medium then a port to another similar but available device and if it is small then a hunt for old/compatible parts.I am suspicious if the only thing is the thing itself... suggests lack of knowledge of function and hence limits the ability to test/verify the next version.

author: Rat_Patrol
author_rank: Frequent Contributor
timestamp: July 23, 2020, 02:50:30 pm
content: Quote from: NivagSwerdna on July 23, 2020, 08:21:08 amWhen the original PCB was ordered, and the company that had the manufacturing contract used a third party to write the software, which is OOB. Apparently, they either didn't get the source files or have lost them. This equipment is 25 years old... Anyway, all I have is the schematic for the PCB itself.Despite the age, industrial equipment can be kept in service quite a while, and while my customer *needs* about 20 boards, he would like a lifetime supply for himself (for the 100 or boards), and since this equipment is still out there, running up 1-2k and then selling them over probably 5 years could make money on my end.Perhaps writing all new software would be appropriate, and it probably is, but I'm not sure the juice is worth the squeeze, especially if we can avoid it. The fun part would be figuring out all the communication protocols for all the various conditions. This micro is apparently monitoring various parameters for fault conditions, along with some type of diagnostic tool communications. Yeah, there is external memory involved.So it is at least partly a RE job, yes.The simplest approach would just be clone the program onto another micro. The program works fine, the hardware is just aging and failing.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: July 24, 2020, 08:16:01 am
content: To be honest the next step is going to involve detail so that would require a schematic.Although 68HC05 is obsolete there are devices like MC908GZ16MFAE which might be of interest. I believe your device is really just a 6800 with a few peripherals (sorry I haven't used that one)... 68HC05 was superceeded by 68HC08?It's all do-able... just depends on how many hours and $ you want to spend!

author: up8051
author_rank: Frequent Contributor
timestamp: July 24, 2020, 04:25:59 pm
content: Try to disassemble code.If source code was written in assembler then disassembly result should be clean and easy to interpret