  We present a systematic study of the properties of TiN films by varying the
deposition conditions in an ultra-high-vacuum reactive magnetron sputtering
chamber. By increasing the deposition pressure from 2 to 9 mTorr while keeping
a nearly stoichiometric composition of Ti(1-x)N(x) (x=0.5), the film
resistivity increases, the dominant crystal orientation changes from (100) to
(111), grain boundaries become clearer, and the strong compressive strain
changes to weak tensile strain. The TiN films absorb a high concentration of
contaminants including hydrogen, carbon, and oxygen when they are exposed to
air after deposition. With the target-substrate distance set to 88 mm the
contaminant levels increase from ~0.1% to ~10% as the pressure is increased
from 2 to 9 mTorr. The contaminant concentrations also correlate with in-plane
distance from the center of the substrate and increase by roughly two orders of
magnitude as the target-substrate distance is increased from 88 mm to 266 mm.
These contaminants are found to strongly influence the properties of TiN films.
For instance, the resistivity of stoichiometric films increases by around a
factor of 5 as the oxygen content increases from 0.1% to 11%. These results
suggest that the sputtered TiN particle energy is critical in determining the
TiN film properties, and that it is important to control this energy to obtain
high-quality TiN films. Superconducting coplanar waveguide resonators made from
a series of nearly stoichiometric films grown at pressures from 2 mTorr to 7
mTorr show an increase in intrinsic quality factor from ~10^4 to ~10^6 as the
magnitude of the compressive strain decreases from nearly 3800 MPa to
approximately 150 MPa and the oxygen content increases from 0.1% to 8%. The
films with a higher oxygen content exhibit lower loss, but the nonuniformity of
the oxygen incorporation hinders the use of sputtered TiN in larger circuits.
