Enabling SWO Debug console on RT1060

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enabling SWO Debug console on RT1060

1,902 Views
alistair
Contributor II

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

0 Kudos
Reply
3 Replies

1,434 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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:

pastedImage_1.png

pastedImage_5.png

pastedImage_3.png

enter debug mode, open View-> Serial Windows -> Debug(printf) Viewer :

 

pastedImage_4.png

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!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,434 Views
alistair
Contributor II

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?

0 Kudos
Reply

1,434 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

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 .

pastedImage_1.png


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply