Let $G$ a finitely generated uniform pro-$p$ group. Then $G/[G,G]$ is abelian and so it is of the form $\mathbb{Z}_p^r\times T$ for some integer $r$ and finite $p$-group $T$. Therefore, $[G,G]$ is contained inside a normal subgroup $H$, with finite index, such that $G/H\cong\mathbb{Z}_p^r$. My question is, under what circumstances is $G$ the semidirect product of $H$ and $\mathbb{Z}_p^r$? I think this is true for $r=1$. Are there other more general conditions that would permit such an isomorphism?
Thanks!