I did not find in the documentation of this microcontroller setting the System Clock Gating Control Register for GPIO,
Can someone help me.
Thanks,
已解决! 转到解答。
Hi
There is no clock gating register for GPIO in the KE parts. That is, there is nothing that needs to be done before using the GPIO.
Regards
Mark
It appears that the the KEA series needs no special clock configuration for the GPIO either. I have not found anything in the reference manual that let's a person select a clock to the port for using GPIO on a particular pin. It apparently just needs the GPIOx_ registers configured. Can you confirm whether this really is the case for the KEA series as well?
Thank you, you are correct.
Test the code below and it worked.
#include "MKE06Z4.h"
// GPIOB/FGPIOB pins 21, 22, 23
#define LED_C_RED 0x200000
#define LED_C_GREEN 0x400000
#define LED_C_BLUE 0x800000
int i = 0, j = 0;
int main(void)
{
// Configure with output direct
FGPIOB->PDDR |= LED_C_RED | LED_C_GREEN | LED_C_BLUE;
// Set all leds with off
FGPIOB->PDOR |= LED_C_RED | LED_C_GREEN | LED_C_BLUE;
for (;;) {
// Port toggle output
FGPIOB->PTOR |= LED_C_RED;
for(i = 0; i < 30000; i++){
for(j = 0; j < 100; j++);
}
}
return 0;
}
Merry Christmas!!!