Switch SDK Debug Console to UART

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Switch SDK Debug Console to UART

跳至解决方案
5,558 次查看
deniscollis
Contributor V

Environment:  MCUXpresso, K81 target, Segger J-Link debug probe, 

Reference: MCUXpresso IDE and Semihosting

With Semihosting the printf output appears in the MCUXpresso Console, as expected.  However, when I switch to UART (Quick Settings -> SDK Debug Console -> UART Console) no output is seen on the LPUART.   With UART selected, no output is sent to the MCUXpresso Console, as expected. 

I have checked that the  SDK_DEBUGCONSOLE define is correctly set (Quick Settings -> Defined Symbols).

I have also checked that the LPUART settings (In my case this is LPUART2 on PTD2/3.) are good.

 

BTW, LPUART Debug output works just fine with my projects on IAR EWARM, so I know the physical HW is OK.

1 解答
3,837 次查看
deniscollis
Contributor V

Oops!  Found the problem, it is not directly related to the routing of the debug console.  It's about printf().  The code uses DEBUG_PRINT(), defined as follows:

define DEBUG_PRINT(fmt, ...) printf("%s: " fmt, __FUNCTION__, ##__VA_ARGS__)

 I.e. it uses printf instead of PRINTF.  (Only PRINTF will work as it's defined as DbgConsole_Printf)

在原帖中查看解决方案

1 回复
3,838 次查看
deniscollis
Contributor V

Oops!  Found the problem, it is not directly related to the routing of the debug console.  It's about printf().  The code uses DEBUG_PRINT(), defined as follows:

define DEBUG_PRINT(fmt, ...) printf("%s: " fmt, __FUNCTION__, ##__VA_ARGS__)

 I.e. it uses printf instead of PRINTF.  (Only PRINTF will work as it's defined as DbgConsole_Printf)