AnsweredAssumed Answered

Why do I need to enable clock for a port?

Question asked by John Battaglia on Oct 16, 2019
Latest reply on Oct 18, 2019 by Daniel Martynek

In the s32 example code there is this line of code I don't understand:


PCC-> PCCn[PCC_PORTD_INDEX] = PCC_PCCn_CGC_MASK; /* Enable clock for PORT D */


//followed by this
PTD->PDDR |= 1<<0; /* Port D0: Data Direction= output */
PORTD->PCR[0] = 0x00000100; /* Port D0: MUX = ALT1, GPIO (to blue LED on EVB) */


Why must you enable the clock for port d? What does this do? I have never seen this done on other micros?