AnsweredAssumed Answered

What configuration needs to change to use a LPUART for the debug console?

Question asked by gorakk on Aug 5, 2019
Latest reply on Aug 6, 2019 by gorakk

We have a custom board but I'm using the FRDM-K22F to figure out this issue.

 

I import the SDK led_blinky sample project and I select "UART" for the SDK Debug Console:

 

And I select "Redirect printf/scanf to UART":

 

 

The default configuration uses UART1 but for various reasons we need to use LPUART0 on our custom board.

 

The imported board.c file has the call to DbgConsole_Init():

 

/* Initialize debug console. */
void BOARD_InitDebugConsole(void)
{
uint32_t uartClkSrcFreq = BOARD_DEBUG_UART_CLK_FREQ;
DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq);
}

 

The defines used in board.c are in board.h:

 

/*! @brief The UART to use for debug messages. */
#define BOARD_USE_UART
#define BOARD_DEBUG_UART_TYPE kSerialPort_Uart
#define BOARD_DEBUG_UART_BASEADDR (uint32_t) UART1
#define BOARD_DEBUG_UART_INSTANCE 1U
#define BOARD_DEBUG_UART_CLKSRC SYS_CLK
#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

#ifndef BOARD_DEBUG_UART_BAUDRATE
#define BOARD_DEBUG_UART_BAUDRATE 115200
#endif /* BOARD_DEBUG_UART_BAUDRATE */

 

I'm not seeing a way to specify LPUART0 instead of UART1.

 

The BOARD_DEBUG_UART_BASEADDR define looks likely but it's not actually used in the code.

 

Has anyone used an LPUART instead of a UART for the debug console?

 

MCUXpresso IDE v11.0.0

SDK 2.6.0

Outcomes