Hi guys,
When I load the default BSP package in Keil for the MIMXRT1060-EVK, my debug console is automatically configured for LPUART as below:
/* Initialize debug console. */
void BOARD_InitDebugConsole(void)
{
uint32_t uartClkSrcFreq = BOARD_DebugConsoleSrcFreq();DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq);
}
I would like to change this to SWO but I'm unsure what settings to use. Is anyone able to advise?
Is there any way to auto-configure this like I can for pins/clock/peripherals?
Many thanks
Hello Alistair Lowe,
You can try the below steps:
1. Enable SWO pins:
#define IOMUXC_GPIO_B0_12_ARM_CM7_TRACE_CLK 0x401F816CU, 0x2U, 0, 0, 0x401F835CU
#define IOMUXC_GPIO_B0_13_ARM_CM7_TRACE_SWO 0x401F8170U, 0x2U, 0, 0, 0x401F8360U
//Set GPIO_B0_12 to TRACE CLK mode
IOMUXC_SetPinMux(IOMUXC_GPIO_B0_12_ARM_CM7_TRACE_CLK, 0U);
//Set TRACE CLK function
IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_12_ARM_CM7_TRACE_CLK, 0x10B0u);
//Set GPIO_B0_13 to TRACE SWO mode
IOMUXC_SetPinMux(IOMUXC_GPIO_B0_13_ARM_CM7_TRACE_SWO, 0U);
//Set TRACE SWO function
IOMUXC_SetPinConfig(IOMUXC_GPIO_B0_13_ARM_CM7_TRACE_SWO, 0x10B0u);
2. Set SWO Trace clock:
CLOCK_EnableClock (kCLOCK_Trace); //Enable TRACE CLK
/* Set TRACE_PODF. */
CLOCK_SetDiv(kCLOCK_TraceDiv, 0);
/* Set Trace clock source. */
CLOCK_SetMux(kCLOCK_TraceMux, 3);
3. Configuration IDE:
enter debug mode, open View-> Serial Windows -> Debug(printf) Viewer :
4. add send code, for example :
while (1)
{
ITM_SendChar('b');
ITM_SendChar('C');
ITM_SendChar('D');
}
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thank you Alice,
This code turns on the SWO but I think the pins are wrong. On the MIMXRT1060-EVK, the JTAG_TDO is on pin GPIO_AD_B0_08 etc. I think it was changed from the 1052 EVK. Are you able to provide settings for these pins?
Hi Alistair Lowe,
Yes, it uses GPIO_AD_B0_10, my code just demonstrate the steps, you can refer to your schematic of your board
and reference manual to configuration .
Have a great day,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------