The main goal of this paper is to provide asymptotic expansions for the numbers # {p <= x : p prime, s(q) (p) = k} for k close to ((q - 1)/2) log(q) X, where s(q)(n) denotes the q-ary sum-of-digits function. The proof is based on a thorough analysis of exponential sums of the form Sigma(p <= x) e(alpha S(q)(p)) (where the sum is restricted to p prime), for which we have to extend a recent result by the second two authors.