  There is strong observational evidence for the presence of large-scale
magnetic fields MF in galaxies and clusters, with strength $\sim \mu$G and
coherence lenght on the order of Kpc. However its origin remains as an
outstanding problem. One of the possible explanations is that they have been
generated in the early universe. Recently, it has been proposed that helical
primordial magnetic fields PMFs, could be generated during the EW or QCD phase
transitions, parity-violating processes and predicted by GUT or string theory.
Here we concentrate on the study of two mechanisms to generate PMFs, the first
one is the $\nu$MSM which triggers instability in the Maxwell's equations and
leads to the generation of helical PMFs. The second one is the usual
electroweak baryogenesis scenario. Finally, we calculate the exact power
spectra of these helical PMFs and we show its role in the production of
gravitational waves finding a scale-invariant on large scales and an
oscillatory motion (damping) for $k\eta \gg 1$
