A method for producing a micromechanical sensor element having a first electrode and a second electrode, wherein electrode wall surfaces of the first and the second electrodes are situated opposite one another in a first direction and form a capacitance, wherein a first one of the first electrode and the second electrode is movable in a second direction, which is different than the first direction, in response to a variable to be detected, and a second one of the first electrode and the second electrode is fixed, the method comprising:
- producing a cavity in a semiconductor substrate, the cavity being closed by a doped semiconductor layer;
- and
- producing the first and the second electrodes in the doped semiconductor layer, including modifying the electrode wall surface of the first electrode in order to have a smaller extent in the second direction than the electrode wall surface of the second electrode,
- wherein modifying the electrode wall surface of the first electrode comprises forming a counterdoped region in the electrode wall surface of the first electrode in a part of the semiconductor layer which faces away from the cavity, and
- wherein the counterdoped region is adjacent to a remaining portion of the electrode wall surface of the first electrode.