PIC16C712 firmware analysis - Page 1
Forum section: electronics / general

author: tony359
author_rank: Frequent Contributor
timestamp: August 15, 2025, 06:32:35 pm
content: Hi allI am troubleshooting a DAC board which refuses to work and I feel I might have found that the PIC on it is failing to sense some sort of "power good" signal.I have a programmer and I have extracted the firmware from the PIC: is it possible to analyse it to understand what it does? I should be fairly simple. I feel it's checking for "power good", then maybe enabling the clock and/or outputs based on signals coming from the main DSP.I am saying this as as soon as I put a probe on RA0 - which seems to be connected to a signal coming from all the available voltages on the board - the "ok" LED turns on immediately.I'm attaching what I have extracted here. Any pointer is very appreciated!ThanksUpdate:I've discovered that RA0 is indeed sensing a crude "power good". The PSU I am using is a bit off on -12V (but still within ATX specs) and the value reaching RA0 is 2.8V. Using an external PSU to feed RA0 I've discovered that the PIC is expecting values between 1V and 2.8V.So either I change the resistor network which turns the main voltages in that 2.8V, or I re-program the PIC. I don't know if the latter is even a possibility.

author: microvia
author_rank: Regular Contributor
timestamp: August 16, 2025, 09:14:59 am
content: Most of the HEX contains raw values so this is a basic firmware.Probably more space is used for the PIC configuration than the code that checks the ADC boundaries corresponding to 1V - 2.8V.The real question is whether the PSU should deliver 1V to 2.8V but doesn't in which case your PIC is ok, or if the PIC is faulty and doesn't read the voltages properly.Disassembling the BIN file should not be that hard since the code takes roughly 400 bytes.

author: voltsandjolts
author_rank: Unknown
timestamp: August 16, 2025, 09:51:05 am
content: Changing the resistor divider (maybe as easy as a 47k from RA0 to GND, or suchlike) is much easier than messing with firmware.

author: tony359
author_rank: Frequent Contributor
timestamp: August 16, 2025, 12:13:31 pm
content: Quote from: voltsandjolts on August 16, 2025, 09:51:05 amindeed and that's what I ended up doing.Quote from: microvia on August 16, 2025, 09:14:59 amVoltages are fine, whoever designed that think assumed that -12V is -12V and +12V is +12V. ATX specs say that -12V is +/- 10% and I have a (Brand new) Seasonic PSU where the -12V is on the edge of the tolerance, it reads -11V when the tolerance allows for -10.8V so I cannot even complain with Seasonic. The circuit MUST allow -10.8V, there is no other way.So yes, I ended up slightly changing the voltage divider for the -12V rail to lower the overall voltage at the PIC.I've also realised the PIC is "C" so it's OTP which would mean replacing it.Thanks for your help!

author: kloetpatra
author_rank: Regular Contributor
timestamp: August 16, 2025, 03:17:15 pm
content: As you said, it is not doing much besides setting outputs based on ADC reading and conditional checks.Just for interest. Attached is the asm listing and decompiled code.

author: tony359
author_rank: Frequent Contributor
timestamp: August 16, 2025, 03:41:03 pm
content: uh this is so cool, thanks for taking the time to decompile the code for me.Because I know nothing about that, I asked AI to explain that to me and I understand that the code is expecting two thresholds on RA0: 1.45V and 2.9V which is exactly what I could see myself when I wired my bench PSU into the pin after disconnecting the rest of the circuit from it.Very cool thanks. I wonder how the designer came up with those values... if I simulate the voltages I have with my current PSU, I end up with 2.89V at the pin which is on the edge so the board gets the green light randomly.Cheers again!

author: microvia
author_rank: Regular Contributor
timestamp: August 16, 2025, 04:59:20 pm
content: Actual decompilers can give impressive outputs. Hopefully your PIC wasn’t locked and the firmware didn’t contain tricks to fool disassemblers.For those interested:Ghidra:https://ghidra-sre.org/Some plugins / tools:https://gist.github.com/adulau/a3a0eefb7828d52747a9d247a82eeeef