Subsequently, an etching step is performed in which part of the amorphous silicon film 502 formed in the recess 501A is etched by supplying a halogen-containing etching gas to the substrate (see FIG. 1C). As a result, the opening in the upper portion of the recess 501A is widened. The halogen-containing etching gas may be, for example, Cl2, HCl, F2, Br2, or HBr, or may be a mixed gas thereof.
Subsequently, an embedding step is performed in which the amorphous silicon film 502 is embedded in the recess 501A by supplying a silicon source gas to the substrate (see FIG. 1D). In an embodiment, the amorphous silicon film 502 is formed such that the opening of the recess 501A is blocked through, for example, a chemical vapor deposition (CVD) method by supplying the silicon source gas in a state in which the substrate is heated. At this time, a void or a seam may be generated in the recess 501A in which the amorphous silicon film 502 is embedded. FIG. 1D represents the case in which a seam 503 is generated in the recess 501A. As the silicon source gas, it is preferable to use hydrogenated silane gas without using the halogen-containing silicon gas. As a result, because the amorphous silicon film 502 is not etched by the halogen originating from the halogen-containing silicon gas, it is possible to embed the amorphous silicon film 502 in the recess 501A in a short period of time.