想用NUC131单片机UART3作为打印口,但printf没有输出东西,UART10、UART1、UART2作为打印口printf都可以正常输出,请教一下大神们,我的配置是否有问题??
void SYS_Init(void)
{
/* Enable Internal RC 22.1184MHz clock */
CLK_EnableXtalRC(CLK_PWRCON_OSC22M_EN_Msk);
/* Waiting for Internal RC clock ready */
CLK_WaitClockReady(CLK_CLKSTATUS_OSC22M_STB_Msk);
/* Switch HCLK clock source to Internal RC and HCLK source divide 1 */
CLK_SetHCLK(CLK_CLKSEL0_HCLK_S_HIRC, CLK_CLKDIV_HCLK(1));
/* Enable external XTAL 12MHz clock */
CLK_EnableXtalRC(CLK_PWRCON_XTL12M_EN_Msk);
/* Waiting for external XTAL clock ready */
CLK_WaitClockReady(CLK_CLKSTATUS_XTL12M_STB_Msk);
/* Set core clock as PLL_CLOCK from PLL */
CLK_SetCoreClock(PLL_CLOCK);
CLK_EnableModuleClock(UART3_MODULE);
/* Select UART module clock source */
CLK_SetModuleClock(UART3_MODULE, CLK_CLKSEL1_UART_S_HXT, CLK_CLKDIV_UART(1));
CLK_EnableModuleClock(UART2_MODULE);
/* Select UART module clock source */
CLK_SetModuleClock(UART2_MODULE, CLK_CLKSEL1_UART_S_HXT, CLK_CLKDIV_UART(1));
/* Init I/O Multi-function */
/*---------------------------------------------------------------------------------------------------------*/
// UART3
SYS->GPA_MFP &= ~(SYS_GPA_MFP_PA5_Msk | SYS_GPA_MFP_PA6_Msk);
SYS->GPA_MFP |= SYS_GPA_MFP_PA5_UART3_RXD | SYS_GPA_MFP_PA6_UART3_TXD;
// UART2
SYS->GPD_MFP &= ~(SYS_GPD_MFP_PD14_Msk | SYS_GPD_MFP_PD15_Msk);
SYS->GPD_MFP |= SYS_GPD_MFP_PD14_UART2_RXD | SYS_GPD_MFP_PD15_UART2_TXD;
}
void UART_Init()
{
SYS_ResetModule(UART2_RST);
UART_Open(UART2, 115200);
SYS_ResetModule(UART3_RST);
UART_Open(UART3, 115200);
}
|