When changing a peripheral clock source by writing to
PCHCTRLm.GEN, the peripheral clock must be disabled before re-enabling it with the new
clock source setting. This prevents glitches during the transition:
- Disable the
Peripheral Channel by writing PCHCTRLm.CHEN=0
- Assert that
PCHCTRLm.CHEN reads '0'
- Change the
source of the Peripheral Channel by writing PCHCTRLm.GEN
- Re-enable the
Peripheral Channel by writing PCHCTRLm.CHEN=1