Hello Fall Guy,
Thanks for the answer on my question. I finally worked out how to fix the problem. My chip was not in the CRP mode. The work around to this code is to add the following code.
void configurePins()
{
/* Enable SWM clock */
// LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 7); // this is already done in SystemInit()
/* Pin Assign 8 bit Configuration */
/* U0_TXD */
/* U0_RXD */
LPC_SWM->PINASSIGN[0] = 0xffff0004UL;
/* Pin Assign 1 bit Configuration */
#if !defined(USE_SWD)
/* Pin setup generated via Switch Matrix Tool
------------------------------------------------
PIO0_5 = RESET
PIO0_4 = U0_TXD
PIO0_3 = GPIO - Disables SWDCLK
PIO0_2 = GPIO (User LED) - Disables SWDIO
PIO0_1 = GPIO
PIO0_0 = U0_RXD
------------------------------------------------
NOTE: SWD is disabled to free GPIO pins!
------------------------------------------------ */
LPC_SWM->PINENABLE0 = 0xffffffbfUL;
#else
/* Pin setup generated via Switch Matrix Tool
------------------------------------------------
PIO0_5 = RESET
PIO0_4 = U0_TXD
PIO0_3 = SWDCLK
PIO0_2 = SWDIO
PIO0_1 = GPIO
PIO0_0 = U0_RXD
------------------------------------------------
NOTE: LED on PIO0_2 unavailable due to SWDIO!
------------------------------------------------ */
LPC_SWM->PINENABLE0 = 0xffffffb3UL;
#endif
}
This is to make sure the pins are correctly configured.
Thanks for the help anyway!