I am desperate need of some advice on what to do next regarding this issue so I am going to include as much detail as I can. I have a 2012 Ford Fiesta, with 98k miles, and an automatic transmission, that I recently replaced the engine in. I felt I had to do so as the previous engine over heated causing oil to mix with coolant and would no longer start. The engine I put into this car was a salvage with 84k miles and seems to be in overall good condition. There were no obvious signs of damage and everything seemed to move that way it should. I used to workshop manual to remove the old engine and install the new engine. The only issues I ran into during this process was that the engine lift I was using was missing parts (I didn't know this at the time) and bent in half during the removal. I could not lift the engine and transmission and had to put them down in engine bay while some of the wiring harness was still connected. I believe this caused damaged the engine wiring harness.
Once I finished installing the engine, I attempted to crank the car and nothing happened. No crank, no start. I scanned for codes and found multiple codes that seemed unrelated to each other. My first thought was that it must be a problem with that starting system, but after going through the diagnostic procedure in the workshop manual I ruled that out. I realized it must have been the wiring harness and then spent hours tracing every wire that went to the PCM and repairing any broken wires I found. I also checked every fuse in the car and none were blown. Once that was completed, I cleared the codes on the car, and the only codes that came back were P0340 and another code related to communication error. I went through the diagnostic procedures for P0340 and found no more issues with the wiring harness and ended at the PCM needed to be replaced. I figured this was possible, as maybe the broken wires had some how damaged the PCM, so I ordered a PCM online from a salvage yard. In addition to this, I felt that there were still issues with the wiring harness, so I purchased a used engine harness and transmission harness. I replaced the engine and transmission harnesses first and this resolved all the check engine lights aside from P0340. When I attempted to start the car, it would crank for about a second and then the would stop cranking. One a few rare occasions, the car would crank for 2 to 3 seconds, but still would not start.
My next course of action was to replace the PCM, with the salvage PCM, which ultimately did not resolve the issue. Once I put the new PCM in, the car would do nothing, No crank/No start. I then swapped it out for the old PCM and the car would Crank No Start. My thought is that the salvage PCM needs to be flashed, which I am willing to do, but don't want to go through the process of doing that if it wont resolve the problem.
Lastly, my next course of action was to recheck and complete the diagnostic procedures in the workshop manual for resolving P0340. I removed the crankshaft position sensor and tested it to ensure that it operated correctly, which it did. I noticed that a corner of it had been ground down slightly, but this did not seem to affect the operation of the sensor. Either way, I then pulled the crankshaft sensor from the old engine and put it in. This sensor was not ground down and I installed it the same way as before. The car still would crank, but not start. After trying to start it a few times, I then removed the sensor, and it also had slight wear in the same corner. I tested this sensor, with a multi-meter, as well and it still was functional. The damage is obviously coming from the flywheel. When I put the new engine in, I had to swap the flywheel from the old engine to the new engine as they were different (maybe the new engine came out of a manual car?). Either way, while its possible I put the flywheel on improperly, I don't think this is the case. I checked the old engine with the new engines flywheel and found that there is only one way for it be installed. I think the grinding issue more has to do with me over tightening the sensor when installing it, but I could be incorrect. Next I replaced the Camshaft position sensors, swapping them from the old engine. This also did not resolve the problem, but I was able to verify that the camshafts are spinning while the engine is cranking. This leads me to believe the engine is mechanically sound and this is still an issue with the PCM.
I have also sought professional help with this problem, but they could not figure it out either. Once I completed repairing the wiring harness and before replacing it all together, I took this car to a local garage on my street, as I could not figure out what to do next. My wife and I pushed it out of our drive way in neutral and coasted downhill to a garage. They had the car for about a week and their diagnosis was that it was an electrical issue. They also tried replacing the crankshaft position sensor, which I had also already tried. They said they couldn't fix it but charged my $85 for what they had done and to get the car back to my house.
Aside from flashing the salvage PCM, I have no idea where to go from here. I am unsure if getting the PCM flashed will resolve the problem. Any help with this would be greatly appreciated as I started this in November thinking it would take me a few days!