My 1996 e36 BMW 328i Convertible was having trouble starting, and it's always broken up slightly at idle since I took ownership of the car. On a couple of hot days last summer it also stalled during idle, then started doing it again recently (even though the ambient temperature was much colder.)
The main sympton at the point I took notice was it struggling to start, then hunting at idle until warm, then promptly stalling when warm and idling. It would also cut out when coming to a stop at junctions.
Reading the codes showed one related to the crankshaft sensor:
53 Crankshaft Sensor
(Codes can also show up in hex, which would be "83 Crankshaft Sensor".)
I duly replaced both the Crankshaft Sensor (Part # 12141703277) and the Camshaft Sensor (Part # 12141703221), but it was still throwing the crankshaft sensor code.
Upon closer inspection, the sensor wire in the plug for the crankshaft sensor wasn't pushed fully into the socket under the intake manifold. This lead to the ECU not being able to get a signal from the sensor, so it quite correctly threw a code and didn't run correctly.
Made sure all the pins were seated in the plug correctly, and reconnected the plug under the intake manifold and she started up perfectly. Drives much better, and the engine pulls more smoothly all the way up the rev range.