We determine effective temperatures, surface gravities, and metallicities for a sample of 343 M dwarfs observed with CARMENES, the double-channel, high-resolution spectrograph installed at the 3.5m telescope at Calar Alto Observatory. We employed SteParSyn, a Bayesian spectral synthesis implementation, along with a grid of synthetic spectra based on BT-Settl model atmospheres and the radiative transfer code turbospectrum. The synthetic grid was computed around 75 magnetically insensitive TiI and FeI along with the TiO gamma- and epsilon-bands. To avoid degeneracies in the parameter space, we imposed Bayesian priors based on multi-band photometric data available for the sample.