I have a 96 Ford ranger with cel p0340 I have recently done a timing belt, engine runs great replaced cmp sensor cel still on

I recently purchased a 1996 Ford Ranger. I replaced the timing belt and shortly after I got a check engine light p0340 camshaft position sensor. The engine seems to run great, so I replaced the camshaft position sensor. The check engine light still comes on. The check engine light doesn't come on right away, usually what it does is it will come on after I start and stop the engine a few times. Please help, is it possible the timing is off even though the engine runs smooth? Should I rry replacing the crankshaft position sensor?

My car has 12100 miles.

– I have a 96 Ford ranger with cel p0340 I have recently done a timing belt, engine runs great replaced cmp sensor cel still on