Toyota Repair: cant advance timing


Question
QUESTION: Hello, i have a 1994 Toyota pickup 4wd, 5 speed with a 2.4L 22re engine. I can not get the timing to advance. At about 176000 it spun a rod bearing so i took it apart and rebuilt the engine. I had the engine bored out and installed a bigger cam. I assembled the engine to specs with regard to the bigger cam, and it runs good but very rich and the timing will not advance. Its right at 5 degrees where it should be with the terminals Te1 and E1 jumped but when i first jump them at idle it wont idle down and when i remove them it doesnt advance, it just stays at 5 gegree. If i try to drive it, it has no power. I ran the codes and came up with 21 and 31. Which is o2 sensor and MAF sensor. I damaged the MAF sensor while working on engine. Took the two screws out and pulled the contacts off circiut bored. So i took the sensor apart and soldered them back on. Code 31 went away but i then got a air intake temp sensor code which is not separate but part of the MAF so i just installed a new MAF sensor. Air intake sensor code went away but 31 came back and code 21 was still there.. I have replaced the o2 sensor cause old one was in bad shape even after cleaning but code is still there. Prior to all this the o2 sensor wire got burned on the exhaust which is where this code 21 came from originally and never went away. Even after i fixed the burned wires, the check engine never went off and i ran it till the rod bearing gave out. Are these just old codes that have been repaired ,but are still in the ECU? I have pulled the 15a efi fuse and also disconnected the negative to battery to erase the codes but they will not. Can u time this engine while it has trouble codes? I cant see any shorts in wires but did notice that the bracket holding ECU was missing a bolt and been rattling around for who knows how long. Is my ECU bad cause i cant erase codes? Thank you for your time:-) . Hope this is enough info

ANSWER: Hello, did this happen right after the engine was replaced or did you drive it for a while and then lost power?

---------- FOLLOW-UP ----------

QUESTION: This happened right after it was rebuilt. The couple times i have drove it, its just had the no power issue.

Answer
It sounds like the cam timing is off or the distributor is off a tooth on the gear, you should be able to time the engine even though there are codes, the cam timing should be re checked but first make sure the distributor is aligned correctly with the #1 cylinder with the crank pulley at TDC.