AnsweredAssumed Answered

UART Device Driver Issue on MCUXpresso 10.3.X and SDK 2.5 

Question asked by Zhiqun Hu on Feb 27, 2019
Latest reply on Feb 28, 2019 by Zhiqun Hu



I am trying to port a KDS3.X/SDK2.X K64 project to MCUXpresso 10.3.X and SDK 2.5.


I noticed the device drivers have been changed on many peripherals, quite a few device driver APIs used in my project's APP need to be updated to the latest device drivers, mainly API naming.


I have done all that, then find out UART related APIs are not working properly. I am using an UART port for a terminal interface application.


I can use a UART directly with UART_Init(_UART, &config, CLOCK_GetFreq(_UART_CLK_SRC)), and

UART_WriteBlocking(_UART, txbuff, sizeof(txbuff) - 1)


But I cannot use:

DbgConsole_Init((uint8_t )_UART, 115200, DEBUG_CONSOLE_DEVICE_TYPE_UART, CLOCK_GetBusClkFreq());

and printf().

Shown in above screenshot, if I un-define DEBUG_CONSOLE_UART, the code can be stepped to API function

UART_WriteBlocking(_UART, txbuff, sizeof(txbuff) - 1) without any issue, but I do not want to do that since I have to create my only printf/scanf.


If I define DEBUG_CONSOLE_UART as shown in the above screenshot, when I stepped into line 96:

UART_EnableInterrupts(_UART, kUART_RxDataRegFullInterruptEnable | kUART_RxOverrunInterruptEnable);

it will generate a hard fault. I have used BDM to check both base and mask information is correctly pass to the function, and I have no clue why a hard fault will be generated right at the cursor highlight line.



I was thinking that may be related to how the project was created with different configurations, library files. After tried to create a few test projects with different configurations I still have the same issue.


Here is one of my project settings:

1. Project created.


2. Configuration (I almost tried all of the library files)


I am wondering if somebody else has seen this problem as well.