it does sound like the crank position sensor is going bad it controls the timing rpm ect. I think I would try that before I spend 1800+ on a new ecm a new cps is about $40 just make sure you use a mopar or Cummins one just went through basically the same thing with a jeep liberty it threw codes for ecm random misfire vac leak I got the cps at advanced auto it still ran like crap and threw same codes put the mopar brand cps in it runs great and no codes again this is just my two cents best of luck hope you get it figured out