You have a bad crank or cam sensor. Its tripping the check engine light because one of the two sensors is going out. Engine will still run fine on only one sensor (either cam or crank) without any issues. Although depending on which sensor is gone it may crank slightly longer before firing.
You may hear a miss for a quick second if the engine tries to use the primary sensor (cam) and its out and switches back to the secondary sensor (crank) but it shouldn't be a constant thing. You're best bet is just to replace the sensor when you get the chance. Kinda nice having the fail safe. If its only running on the one sensor and they both fail the engine will not run.