I'm new to Freescale microcontrollers. I'm now using TWR-K21D50 board for one of my project. Initially i'm triying to control GPIO pins. I have to glow the D5 led connected to the PTD4 pin. I have put my code below. But not working.
SIM_SCGC5 |= SIM_SCGC5_PORTD_MASK; // enabled clock for the portd
PORTD_PCR4 = PORT_PCR_MUX(1); //selected gpio functionality for pin
GPIOD_PDDR = GPIO_PDDR_PDD(4); //put as output pin configuration
GPIOD_PCOR = GPIO_PCOR_PTCO(4); // to make my pin low to glow the led (anode connected to 3.3v and cathode to GPIO Pin)
Please help me to diagnose the problem in my code.