If I got that right, you had a new engine that ran fine. You flashed it and then it stopped working.
Then you installed a new controller and a new torque sensor and the engine ran back to normal. Then you flashed again and the engine did not run again. Flashing back the stock firmware did not work in either case.
To fix the problem, you've only disassembled the engine umpteen times and looked for a hardware cause or setting. IF the engine went before that shouldn't be the case. I also can't imagine that anything has been changed on the old controller variant, since a new one has long been installed and psw only sells old stocks.
Then the only plausible cause remains an error during flashing: incorrectly connected, defective cables, broken stlinkv2, wrong flash tool, wrong software version ...
Then you installed a new controller and a new torque sensor and the engine ran back to normal. Then you flashed again and the engine did not run again. Flashing back the stock firmware did not work in either case.
To fix the problem, you've only disassembled the engine umpteen times and looked for a hardware cause or setting. IF the engine went before that shouldn't be the case. I also can't imagine that anything has been changed on the old controller variant, since a new one has long been installed and psw only sells old stocks.
Then the only plausible cause remains an error during flashing: incorrectly connected, defective cables, broken stlinkv2, wrong flash tool, wrong software version ...