running rough engine code P0325 on 2000 Nissan Xterra

2000 xterra replaced distributor cap, rotor, spark plug wires and fuel filter, runs fine when first started from being cold - once warm starts running rough knocking and loses power - stalls out , wont start back up

Asked by for the 2000 Nissan Xterra
Not sure if you solved this issue yet, but that code is for a knock sensor and could be either a bad sensor or sensor wiring.