Hi Nakul,
In the hello_world_twrk21f120m project the hello_world.c has following in main():
/* Init board hardware. */
BOARD_InitPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();
In the BOARD_InitPins() in pin_mux.c you need to change the UART pin configuration from default UART5 (PTD8/9) to UART1 (PTE0/1):
void BOARD_InitPins(void)
{
#if 1 //DES 1=test changing default UART, 0=default code
/* Initialize UART1 pins below */
/* Ungate the port clock */
CLOCK_EnableClock(kCLOCK_PortE);
/* Affects PORTD_PCR8 register */
PORT_SetPinMux(PORTE, 0u, kPORT_MuxAlt3);
/* Affects PORTD_PCR9 register */
PORT_SetPinMux(PORTE, 1u, kPORT_MuxAlt3);
#else
/* Initialize UART1 pins below */
/* Ungate the port clock */
CLOCK_EnableClock(kCLOCK_PortD);
/* Affects PORTD_PCR8 register */
PORT_SetPinMux(PORTD, 8u, kPORT_MuxAlt3);
/* Affects PORTD_PCR9 register */
PORT_SetPinMux(PORTD, 9u, kPORT_MuxAlt3);
#endif
}
Then in board.h you need to changes the clock source as follows:
#define BOARD_USE_UART
#if 1 //DES 1=test changing default UART, 0=default code
#define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_UART
#define BOARD_DEBUG_UART_BASEADDR (uint32_t) UART1
#define BOARD_DEBUG_UART_CLKSRC kCLOCK_CoreSysClk //DES this MARCO not used but update to not confuse user
#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetCoreSysClkFreq()
#define BOARD_UART_IRQ UART1_RX_TX_IRQn
#define BOARD_UART_IRQ_HANDLER UART1_RX_TX_IRQHandler
#else
#define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_UART
#define BOARD_DEBUG_UART_BASEADDR (uint32_t) UART5
#define BOARD_DEBUG_UART_CLKSRC kCLOCK_BusClk
#define BOARD_DEBUG_UART_CLK_FREQ CLOCK_GetBusClkFreq()
#define BOARD_UART_IRQ UART5_RX_TX_IRQn
#define BOARD_UART_IRQ_HANDLER UART5_RX_TX_IRQHandler
#endif
I do not have a TWR-K21F120M to test this with but I believe the above should work.
Hope this helps.
Regards,
David