DbgConsole_Init() Inconsistancy in SDK_2.x_MIMRT1062xxxxA V2.7.0

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

DbgConsole_Init() Inconsistancy in SDK_2.x_MIMRT1062xxxxA V2.7.0

2,074 Views
martinhowell1
Contributor III

I have just installed MCUXpresso V11.1.1 and with it the prebuilt SDK V2.7.0 for the RT1062 CPU. I then imported the SDK example for hello world. I am using the onboard UART to for the debug output. This did not work. Upon investigation I found in board.c/h the following:


/* The UART to use for debug messages. */
#define BOARD_DEBUG_UART_TYPE DEBUG_CONSOLE_DEVICE_TYPE_UART
#define BOARD_DEBUG_UART_BASEADDR (uint32_t) LPUART1
#define BOARD_DEBUG_UART_INSTANCE 1U

/* 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);
}

The call to DbgConsole_Init() is inconsistant with the prototype in fsl_debug_console.h:

status_t DbgConsole_Init(uint8_t instance, uint32_t baudRate, serial_port_type_t device, uint32_t clkSrcFreq);

I changed to code in board.c to the following:

/* Initialize debug console. */
void BOARD_InitDebugConsole(void)
{
uint32_t uartClkSrcFreq = BOARD_DebugConsoleSrcFreq();

DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE , BOARD_DEBUG_UART_BAUDRATE, kSerialPort_Uart, uartClkSrcFreq);
}

And the example now works.

There seems to be a mix up with the way that the debug console was defined in earlier versions of the SDK. I havent looked at other examples but the board.c/board.h module is common toi a lot of these examples so I am guessing they wioll all have a similar problem.

I love the fact that NXP provides so much example code, but it is less than useful when one of the more elementary examples designed to check that your build and debug enviroment is running ok does not work!!

Martin

0 Kudos
3 Replies

1,991 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Martin Howell,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
I import the hello_world demo from the SDK 2.7.0, and run this demo and it works well actually.
The BOARD_InitDebugConsole() function is below.
/* Initialize debug console. */
void BOARD_InitDebugConsole(void)
{
    uint32_t uartClkSrcFreq = BOARD_DebugConsoleSrcFreq();

    DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq);
}

BTW, you configure the SDK debug console by following the below figure.

pastedImage_2.png

Have a great day,
TIC

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,991 Views
martinhowell1
Contributor III

Well that is very odd!!

I have just opened a new workspace and imported the hello_world SDSK example and I get the same as I did before. It uses the old way of invoking the debug console:

I should point out that I have been working with MCUXpresso for as long as it has been released and have multiple versions of this and the SDK's installed on my dev box.

Here is a screen shot with the hello_world project imported and showing the contents of board.c

pastedImage_1.png

Here are the SDK's I currently have installed

pastedImage_2.png

Here is the version of MCUXpresso

pastedImage_3.png

Is nobody else seeing this issue, or is it just me?

0 Kudos

1,991 Views
martinhowell1
Contributor III

Ok I have found the issue.

It was the fact that I had another SDK for the same CPU installed but an earlier version, V2.4.0.

If I untick the checkbox in the Installed SDK's for the older SDK then import the hello_world example from the latest SDK it all works as expected.

Looks like the import SDK example wizard pulls some of the files from the wrong SDK if you have multiple ones installed (At least on my machine).

Anyway problem solved for me, but might be something to be wary of in the future.