When my check engine light came on in my 97 E36 M3 and it turned out to be code P0340 (Camshaft Position Sensor), I started researching the issue. The consensus across the forums and online was to ensure to use the original BMW or also the Siemens VDO version. Turned out to be great advice. I ordered the Siemens part from Pelican and no more check engine light!

Pelican Parts
Description: Continental VDO, Camshaft Position Sensor
Part #: 12-14-1-703-221-M82