Timely post. I also have a 2001 X5, mine is the 3.0 (I6). I was driving along today and as I came to a stop at a red light, stalled out. I restarted and then the Check Engine Light came on. When I got home I pulled the code - P0340. Camshaft Position Sensor A.
I've read that P0340 is the code for the Intake sensor (not the exhaust). I have ordered one and hopefully that will do the trick.
Thanks for the video that is helpful.