Let the EGR valve be disconnected for a while and keep it running with the old wiring and ecu. Adjust the valve clearance to 0.30 mm (both inlet and exhaust) when the engine is hot. Next check the No.1 cylinder advance spark (it should be around 7-8 degrees BTDC at idle speed at operating temperature). In addition check the health of heated oxygen sensor 1 (upstream) with a diagnostic tool ( at 2500 rpm the oxygen sensor reading should go high (900 mv) and low (100 mv) 3 to 5 times in a second. Hopefully the defect lies somewhere here in these areas. Good Luck.